This is a Wordpress plugin that adds features for using LinkedEvents API data with Wordpress installation.
Key features:
- Support for managing events from Wordpress admin view
- Gutenberg block for listing events from API
- Fully translated to English and Finnish
- Developer-friendly theming support
1. Upload folder into /wp-content/plugins -directory
2. Activate the plugin in 'Plugins' menu
3. Configure settings (see Configuration section for details)
The plugin adds new block category LinkedEvents into Gutenberg. The category contains option for adding an event list and an event search blocks:
Gutenberg event list block can be used to list events from the LinkedEvents API.
The block can be added to the page by clicking the item. When added to the page, the plugin display a preview of the block in page.
There are lots of options for controlling how the event list works
All options have localized usage help texts in editor. Help texts can be displayed by hovering over the option title in the editor view.
Here is a brief summary of each option:
Show events beginning or ending after this time. Date can be today or specified date
Show events beginning or ending before this time. Date can be today or specified date
Show events that are within this bounding box. Coordinates are given in order west, south, east, north. Period is used as decimal separator.
Show events in given locations
You may filter places by specific OCD division id, or by division name
You may filter events by place address locality name (finnish)
Show events with specified keywords
Show events based on whether they are part of recurring event set
Sort the returned events in the given order
Show maximum number of results in list
Filter events by their duration (in seconds)
Event search block can be used to search event from LinkedEvent API in conjunction with the event list block.
Plugin adds functionality to manage events directly from Wordpress admin view. All admin functions can be found from the admin dashboard menu Events
Management view events list contains list of events from the API. Events can be filtered by their status (published, draft or all)
Event list also has a free-text search and pagination support
When hovering over the event with mouse, available actions for specific event are displayed.
Edit action opens an event edit view. Edit view can be used to directly modify the event in the API.
Delete action can be used to delete event
Menu also contains similar lists for controlling keywords and places.
Plugin configuration can be done from the administration panel settings menu.
View opening from the menu contains all the settings for the plugin
Here is a brief summary for each option
API URL for the LinkedEvents server. This option is required for all installation
Datasource for events. This option is required only for installation using event management functions.
Publisher organization for events. This option is required only for installation using event management functions.
Used timezone when displaying event dates. Defaults to Europe/Helsinki
Google maps API key. This option is required only for installation using event management functions.
Gutenberg event list has a theming support.
By default plugin renders very basic event list but you can customize how the list is rendered by adding linkedevents/events.php into you theme.
Theming can be enabled by adding linkedevents -folder into your theme and adding events.php file inside it.
The events.php file can be used to render the event how ever the theme developer wishes it. All events are exposed in variable $data->events.
The events list objects are Event -instances from linkedevents-client-php -library
events.php can contain any php code. Here is a small example that renders event name, time and description inside article tag:
foreach ($data->events as $event) {
$result = "";
$result .= '<article>';
$result .= '<div>';
$eventName = $event["name"]["fi"];
$eventLink = $event["externalLinks"][0]["link"];
$eventDescription = $event["description"]["fi"];
$eventTime = $event["startTime"]->format("l jS F Y G:ia");
$result .= sprintf('<a href="%s">%s</a>', $eventLink, $eventName);
$result .= sprintf('<p>%s</p>', $eventTime);
$result .= sprintf('<p>%s</p>', html_entity_decode($eventDescription));
$result .= '</div>';
$result .= '</article>';
echo $result;
}
Example theme can be found from the GitHub repository wordpress-linkedevents-example-theme