This plugin grabs event data from LearnToronto.org v1 api (http://learntoronto.org/api/v1/), and generates a new learntoronto_event custom post type.
{
events: [ // Array of event objects
{
id: Integer, // LearnToronto Event ID
name: String, // Event Name
start_time: DateTime UTC, // Start Time and date of event
url: String, // url to event's websitem
description: String, // Text containing HTML
updated_at: DateTimeUTC, // Event info updated at Time UTC
group: String // Name of the Group/Organization that is organizing/owns the event
venue: { // JSON object representing the Venue info/address
name: String, // Name of venue
address_1: String, // Address Line 1 of venue - typically the street number and name
address_2: String, // Address Line 2 of venue - typically suite number or other
city: String, // City of venue
state: String, // Province/State of venue
zip: String, // Postal/Zip Code of venue
country: String // Country Name/Code of venue
}
}
]
}The learntoronto_event post type is created by <plugin_dir>\post-types\learntoronto-event-posttype.php.
The following shows the mapping of Wordpress loop functions to the corresponding API values upon creation/update:
- WP Function
the_content()maps todescription - WP Function
the_title()maps toname
These are added upon create/update actions except for the_title().
All postmeta fields are prefixed with learntoronto_event_ followed by their respective attribute names.
postmeta field learntoronto_event_id maps to the event's id attribute.
postmeta field learntoronto_event_url maps to the event's url attribute.
-
Description does not map to a postmeta field. Instead it is saved as the custom
learntoronto_eventpost type'spost_contentand can be called withthe_content()call inside of the Wordpress loop. -
Venue maps into 8 distinct postmeta fields. Each field has the prefix
learntoronto_event_venue_followed by the venue's attribute name.venue: {name:}maps tolearntoronto_event_venue_namevenue: {address_1:}maps tolearntoronto_event_venue_address_1venue: {address_2:}maps tolearntoronto_event_venue_address_2venue: {city:}maps tolearntoronto_event_venue_cityvenue: {state:}maps tolearntoronto_event_venue_statevenue: {zip:}maps tolearntoronto_event_venue_zipvenue: {country:}maps tolearntoronto_event_venue_country- Special
learntoronto_event_venue_full_addressis the concatenated value for allvenueobject attribute values.
Example: venue: { name: } maps to learntoronto_event_venue_name. the 8th distinct postmeta field for venue is the ````learntoronto_event_full_address``` postmeta field which concatenates the venue object values to a single string - which is used for things like maps APIs/searches.
Updates are performed at 4am each day. This is registered with Wordpresses' built-in "cron" system.