Search Form Parameters
The search form provides a powerful set of options to completely customize the look and layout. These options are largely available as settings, but can be overridden completely when displaying directly via shortcode or PHP functions.
Below is a comprehensive list of all the accepted attributes you can pass onto a search form display method or component. Components that can display a search form include calendars, events, locations and single search forms.
This includes (but not limited to):
[events_search_form]
[events_list]
[events_list_grouped]
em_events
em_event_search_form()
[events_calendar]
EM_Calendar::output()
em_get_location_search_form
[locations_list]
[locations_search]
For parameters with mixed[]
, int[]
, and string[]
type values, can be supplied as comma-delimited lists in shortcode, such as views="map,calendar"
. Can also be supplied an array if invoked via PHP, both lines below would mean the same.
echo EM_Calendar::output( array('views' => array('map','calendar') ));
echo EM_Calendar::output( array('views' => "map,calendar" )); // same as an array
Single values are also accepted, such as categories_include="123"
or
events_search_form( array('categories_include' => 123 ) );
For parameters with bool
type values, shortcode would only accept the values 1
or 0
whereas PHP would also accept true
or false
.
For parameters with settings default values, these can be defined in the Events Manager settings page, mostly under the Formatting > Search Form
section.
General Options
These are options related to the search form in general, and the way results are displayed.
Main Search Form
The main search form can be displayed above event/location lists, calendars or on their own. This is an example main search bar:
The options below affect the display of the components of the above search bar.
Search Term
This is a text search field, used for searching within event names, descriptions, location info etc.
Dates (Scope)
Displays a date picker when searching events.
Attribute | Type | Default | Description |
---|---|---|---|
scope | string | Accepts a valid scope value. Defaults to events search scope in settings. | |
search_scope | bool | settings | Show or hide the dates search option in the main form |
scope_label | string | settings | Placeholder label for the dates search input field. |
scope_seperator | string | settings | Separator for dates, for example 12 Dec to 20 Dec |
scope_format | string | settings | Format for displaying dates within the scope, accepts JS placeholder formats, d/m/Y would be 31/12/2030 |
Location (GeoLocation)
Geolocation involves translating a textual location name into a set of map coordinates (longitude/latitude).
GeoLocation searches requires you to set up Google Maps API services.
It is possible to search for location based on a name which is autocompleted using Google Geolocation Autocomplete services, and obtains a set of coordinates to search for nearby events. The distance searched can also be adjusted via settings below.
Additional search parameters are found in the advanced section, such as the distance radius according to the selected geolocation search.
The default distance used to search is based on settings or the near_unit and near_distance values. If advanced search is enabled along with location search options, these can be overridden in the advanced search options by the user.
Attribute | Type | Default | Description |
---|---|---|---|
search_geo | bool | settings | Whether geographic search is enabled |
geo | string | Default geographic search term. info This value will not be used unless a user clicks on the input field, and selects a value from the autoselection options. In the screenshot above, if you used | |
geo_label | string | settings | Placeholder label for the geographic search field |
near_unit | string | settings | Default unit of distance for proximity search, combined with near_distance Accepted Values : |
near_distance | integer | settings | Default distance for proximity search, accepts a numerical value, for example 10 may equate to 10 kilometers if near_unit is set to km |
Advanced Search
The advanced search contains additional search options, such as categories, tags and additional location parameters. This can be displayed in modal form, or inline below the main search form.
This can also be displayed instead of the main search form, by supplying show_main as 0
.
The advanced search form can contain all the search options from the main bar, and are synced between the two sections.
This is particularly useful in situations where just a modal or inline search form options are shown, whilst the main search is hidden.
Calendars, for example, can have an advanced search trigger next to the month selection and bring up a modal set of search options, rather than having a search bar above it.
Attribute | Type | Default | Description |
---|---|---|---|
show_advanced | bool | settings | Whether to show advanced search options, default is based on settings and other conditions. |
advanced_mode | bool | settings | Mode or style of the advanced search area which can be note If show_main or advanced_trigger are set to |
advanced_hidden | bool | settings | Whether advanced search options is hidden by default. note If show_main or advanced_trigger are set to |
advanced_trigger | bool | settings | Whether a trigger icon is displayed in main search form. Defaults to 1 if advanced search is enabled but hidden. |
search_advanced_style | string | accordion | Style of the advanced search dropdowns, which will either show as a collapsible accordion or a dropdown-style multiselect without any collapsible accordion. |
search_multiselect_style | string | settings | Style for multiselect dropdowns, can be used in combination with search_advanced_style so that multiselect dropdowns are displayed but still collapsed within an accordion. |
Dates (Scope)
Same as the dates search option in the main search form.
The date search options are synced between the main and advanced forms, so if a user selects a date range in the advanced form, it will also show up in the main search form if both are set to be shown.
Attribute | Type | Default | Description |
---|---|---|---|
search_scope_advanced | bool | settings | Whether scope options are displayed in advanced settings |
scope_label_advanced | string | settings | Label for the advanced dates search field |
scope_seperator_advanced | string | settings | Separator for dates, for example 12 Dec to 20 Dec |
scope_format_advanced | string | settings | Format for displaying dates within the scope, accepts JS placeholder formats, d/m/Y would be 31/12/2030 |
Categories
The way tags selections are displayed is controlled by the search_advanced_style and the search_multiselect_style
Tags
The way tags selections are displayed is controlled by the search_advanced_style and the search_multiselect_style
Location
User can search and select geographical or geolocation filtering options.
Geolocation Options
Geolocation searches are based on autocompletion of a searched place via the Google search service, which correlates to a set of geographical coordinates, as defined in the main search geolocation options.
The geolocation search options are dependent on the geolocation search input, which can be present at the top of the advanced search form and/or within the main search form.
Once a geolocation is selected, proximity options will be displayed instead of geographical search options such as town, country etc.
Geographic Search Options
Geographic searches are input fields such as city/town, region, country etc.
When a dropdown field is selected, other dropdown fields are filtered to provide the available locations with subsequent options.
For example, if you choose a country such as United Kingdom, only towns, regions, states within that country will be available for choosing, if none exist then only the 'All' option remains available.