Skip to main content

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):

info

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 ) );
info

For parameters with bool type values, shortcode would only accept the values 1 or 0 whereas PHP would also accept true or false.

info

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.

AttributeTypeDefaultDescription
ajax bool1Whether AJAX loading is used, default is defined by the EM_AJAX_SEARCH PHP constant, which by default is set to 1
id stringRandom number to uniquely identify each instance, and is postfixed to class and id names in the search form HTML elements.

Define a unique number or word to create a search form with stable IDs for use in CSS/JS customization.

For example, custom be prefixed to various id and class names, such as id="search-form-custom"
css_classes string[]Accepts a comma-delimited or PHP array of strings which will be appended to the wrapping HTML element class property.
saved_searches bool0Whether saved searches are enabled, if enabled search settings are saved to browser using cookies.

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:

A main search bar for events

The options below affect the display of the components of the above search bar.

AttributeTypeDefaultDescription
show_main boolsettingsWhether to show the main search form. It is possible to hide the main search form and only show the advanced search form instead.
sorting boolsettingsIf the sort button is displayed on the form.
search_action stringsearch_eventsAdvanced Usage Only Action to be performed, submitted during searches to EM backend. Modify in event of advanced customization.
search_button stringsettingsText or label for the search button
views string[]settings

Views enabled for the search form, which user can select in search form options. Accepts a comma-delimited string or PHP array. Accepted values are list, list-grouped, map, grid, calendar

Example: list,map,grid

view stringsettingsDefault view for displaying search results, accepts any value in views

Search Term

This is a text search field, used for searching within event names, descriptions, location info etc.

AttributeTypeDefaultDescription
search_term boolsettingsShow or hide the search term text box.
search stringDefault search term, useful if you would like to populate the form with a default search term.
search_term_label stringsettingsPlaceholder text for the search term input field.

Dates (Scope)

Displays a date picker when searching events.

AttributeTypeDefaultDescription
scope stringAccepts a valid scope value. Defaults to events search scope in settings.
search_scope boolsettingsShow or hide the dates search option in the main form
scope_label stringsettingsPlaceholder label for the dates search input field.
scope_seperator stringsettingsSeparator for dates, for example 12 Dec to 20 Dec
scope_format stringsettingsFormat 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).

warning

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.

An example geolocation search.

Additional search parameters are found in the advanced section, such as the distance radius according to the selected geolocation search.

note

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.

AttributeTypeDefaultDescription
search_geoboolsettingsWhether geographic search is enabled
geostring

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 san fr clicking the search field would show those results immediately without further typing.

geo_labelstringsettingsPlaceholder label for the geographic search field
near_unitstringsettings

Default unit of distance for proximity search, combined with near_distance

Accepted Values : mi or km

near_distanceintegersettingsDefault distance for proximity search, accepts a numerical value, for example 10 may equate to 10 kilometers if near_unit is set to km

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.

tip

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.

AttributeTypeDefaultDescription
show_advancedbool settingsWhether to show advanced search options, default is based on settings and other conditions.
advanced_modebool settings

Mode or style of the advanced search area which can be inline or modal.

note

If show_main or advanced_trigger are set to 0 this value will always be set to inline, since there is no way to trigger opening a modal.

advanced_hiddenbool settings

Whether advanced search options is hidden by default.

note

If show_main or advanced_trigger are set to 0 this value will always be set to 1, since there is no way to trigger showing hidden options.

advanced_triggerbool settingsWhether a trigger icon is displayed in main search form. Defaults to 1 if advanced search is enabled but hidden.
search_advanced_stylestringaccordionStyle of the advanced search dropdowns, which will either show as a collapsible accordion or a dropdown-style multiselect without any collapsible accordion.
search_multiselect_stylestringsettingsStyle 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.

tip

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.

AttributeTypeDefaultDescription
search_scope_advanced boolsettingsWhether scope options are displayed in advanced settings
scope_label_advanced stringsettingsLabel for the advanced dates search field
scope_seperator_advanced stringsettingsSeparator for dates, for example 12 Dec to 20 Dec
scope_format_advanced stringsettingsFormat for displaying dates within the scope, accepts JS placeholder formats, d/m/Y would be 31/12/2030

Categories

note

The way tags selections are displayed is controlled by the search_advanced_style and the search_multiselect_style

AttributeTypeDefaultDescription
category integer0Default category term
search_categories boolsettingsWhether category search is enabled
category_label stringsettingsLabel for the category search field
categories_label stringsettingsDefault label for categories select
categories_placeholder stringsettingsPlaceholder text for advanced category search
categories_clear_text string"Clear Selected"Text for clearing selected categories
categories_count_text string"%d Selected"Text displaying count of selected categories
categories_include mixed[]settingsCategory IDs or slugs to include in the list of searchable tags. For example, jazz,123,rock.
categories_exclude mixed[]settingsCategory IDs or slugs to exclude in the list of available tags. For example, jazz,123,rock.

Tags

note

The way tags selections are displayed is controlled by the search_advanced_style and the search_multiselect_style

AttributeTypeDefaultDescription
search_tags boolsettingsWhether to display the tag search option.
tag mixed[]0Default tag term(s) to be used in searches. Accepts term IDs or slugs
tag_label stringsettingsText Label for the tag search field.
tags_label stringsettingsDefault text label for tags select box, default setting is "All Tags"
tags_placeholder stringsettingsPlaceholder text for the tag filter search box, used to find the tag(s) to filter searches with.
tags_clear_text stringClear SelectedText for clearing selected tags
tags_count_text string%d SelectedText displaying count of selected tags
tags_include mixed[]settingsTag IDs or slugs to include in the list of searchable tags. For example, jazz,123,rock.
tags_exclude mixed[]settingsTag IDs or slugs to exclude in the list of available tags. For example, jazz,123,rock.

Location

User can search and select geographical or geolocation filtering options.

AttributeTypeDefaultDescription
search_geo_advanced boolsettingsWhether geolocation search is shown in advanced settings,
geo_label_advanced stringsettingsLabel for the advanced geographic/geolocation search option fields.

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.

info

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.

AttributeTypeDefaultDescription
near_unit stringsettingsDefault unit of distance for proximity search, combined with near_distance, accepts mior km
near_distance integersettingsDefault distance for proximity search, accepts a numerical value, for example 10 may equate to 10 kilometers if near_unit is set to km
search_geo_units stringsettingsUnit for geographic search
geo_units_label stringsettingsLabel for the geographic units field
near stringDefault proximity search parameters
geo_distance_values int[]settingsPossible distance values for proximity search

Geographic Search Options

Geographic searches are input fields such as city/town, region, country etc.

info

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.

AttributeTypeDefaultDescription
search_countries boolsettingsWhether country search dropdown is displayed.
country stringsettingsDefault country pre-selected in dropdown, default value taken from settings page.
country_label stringsettingsLabel for the country search field
countries_label stringsettingsDefault label for countries select dropdown options, equivalent to All Countries
search_regions boolsettingsWhether region search dropdown field is enabled
region string""Default region pre-selected in dropdown.
region_label stringsettingsLabel for the region search dropdown field.
search_states boolsettingsWhether state search is enabled
state string""Default state pre-selected in dropdown
state_label stringsettingsLabel for the state search field
search_towns boolsettingsWhether town search is enabled
town string""Default town pre-selected in dropdown
town_label stringsettingsLabel for the town search field