The event listings
For showing all the event listings, users need to create a new page from pages menu at admin panel and must add shortcode [events] or also can add the shortcode in template file which bound with the created page.
The shortcode outputs a list of your events/the event listings as well as filters for searching.
Setup for the event listings
Create a new page, follow the path, WP-admin >> Pages >> New Page and name it something along the lines of “Events” and then inside the content area add the shortcode:
It is best to insert the shortcode into the ‘text’ view of the visual editor to ensure it gets formatted correctly.
Layout of the event listings
The users get a 2 type of layout for all the events listed on the website, a box layout and a list layout of the event listings.
The box layout appears like this in the image:
The list layout appears like this in the image:
The Event Listings Shortcode Attributes
The following are the different attributes that are associated with the event listings
- per_page: Defaults to the ‘per page’ option in settings. This controls how many events get listed per page.
- orderby: Supports title, ID, name, modified, parent, rand,event_start_date.
- order: Defaults to ‘ASC’. Can be set to ‘ASC’ or ‘DESC’ to choose the sorting direction.
- show_filters: Defaults to true. Shows filters above the event list letting the user narrow the list by keyword, location, and event type. Once a filter is chosen, active filters are listed above the events, as is an ‘RSS’ link for the current search.
- show_categories: Defaults to true when categories are enabled. If enabled, the filters will also show a dropdown letting the user choose a event category to filter by.
- show_event_types: Defaults to true when event types are enabled. If enabled, the filters will also show a dropdown letting the user choose a event type to filter by.
- show_tags: Defaults to true when event tags are enabled. If you want to hide event tags from event listing page set it to false.
- show_ticket_prices: Defaults to true when ticket prices are enabled. If enabled, the filters will show a dropdown letting the user choose a event by prices, i.e paid or free
- show_category_multiselect: Defaults to true when event category multiselect are enabled. If enabled, the filters will allow users to select multiple categories at a time.
- show_event_type_multiselect: Defaults to true when event type multiselect are enabled. If enabled, the filters will allow users to select multiple event types at a time
- show_pagination: Defaults to false. Enable this to show numbered pagination instead of the ‘load more events’ link
- show_more: Defaults to false. Enable this to show pages as ‘show more’ rather than page numbers.
- categories: Comma separate slugs to limit the events to certain categories. This option overrides ‘show_categories’ if both are set.
- event_types: Comma separate slugs to limit the events to certain event types.
- featured: Set to true to show only featured events, false to show no featured events, or leave out entirely to show both (featured first).
- cancelled: Set to true to show only cancelled events, false to show no cancelled events, or leave out entirely to respect the default settings.
- location: Enter a location keyword to search by default.
- keywords: Enter a keyword to search by default.
- selected_datetime: Select the range of date & time to showcase particular event happening in that time frame. It takes, “Today, Tomorrow, and all the dates.
- [events selected_datetime=”today,2020-08-31″]
- [events selected_datetime=”tomorrow,2020-08-31″]
- selected_event_type: Comma separate slugs to select by default.
- selected_category: Use Comma to separate slugs(categories) to select by default.
- selected_ticket_price: This will accept paid/free/donation as values to list by default .
- layout_type:This will accept box or list value in layout type.Default it will take box.
- ticket_prices:This will accept paid/free/donation as values to list by default.
- event_online: The shorcode helps to display only the online events on the event listing page.
If the URL of the page contains a query string and location or keywords is set, the values in the query string will populate the location and keywords fields instead of the above options.
Show 10 of the most recent events without filters and pagination
[events per_page="10" show_filters="false"]
Show 15 events at a time, ordered by title, with categories disabled:
[events per_page="15" orderby="title" show_categories=false]