The event search shortcode is included in Event Organiser Pro. If you haven’t done so already, you can purchase Pro here: wp-event-organiser.com/pricing.
The event search shortcode
[event_search] adds a search form to your page which allows your visitors to search, and optionally filter, your events.
filters attribute accepts comma separated list of the filters you want to be available to your visitors. The order in which you specify the filters is the order in which they appear.
Possible filters include
- event_category – a drop-down to filter events by category
- event_venue – a drop-down to filter events by venue
- event_tag – a drop-down to filter events by tag
- city – a drop-down to filter events by city
- state – a drop-down to filter events by state
- country – a drop-down to filter events by country
- date – two fields with datepickers to filter events by a date range.
You can restrict the search to certain venues, categories etc or set the number of events returned per page by using any of the attributes supported by the event list shortcode.
Any event query attributes specified will form part of the event query, but any of the above filters will over-ride those attributes. For example:
[event_search event_start_after="now" filters="date"]
will, by default show only events which start in the future. However, the user could use the date filter to search for past events too.
Note: You should use
posts_per_page to configure the number of returned events on each page, and not
For example, this will configure the search to return 5 events per page (default is 10):
The shortcode produces something like:
To create the above search form:
If you wanted to the date filter to appear immediately to the right of the search field
Formatting the output
You can change how the search results appear on the page by copying the template file
search-event-list.php from inside the templates subdirectory of Event Organiser Pro and editing there as desired. See editing the templates for more information.