Skip to main content

Template Tags

Template tags

If you're into theming, you should probably use the template tags provided by Events Manager. The following tags insert event-related elements into your templates. At least a basic knowledge of PHP and wordpress template tags is needed to use these.

Here are some basic tags that you may find useful for displaying certain information from Events Manager.

tip

For advanced users, we suggest you check out the em-template-tags.php file, and see the underlying functions used within these template tags. Whilst the functionality is ultimately the same, you can get finer control using root functions.

For example, em_calendar() is the same as EM_Calendar::output().

Display Event Information

Events Manager was made with flexibility in mind, especially for developers, so if you know what you’re doing and want to do more with Events Manager, see our advanced useage page.

info

All of these functions below the $args variable can be an array or query-string with any event accepted arguments.

tip

If you change the function names below from em_ to em_get_, the function will return the value rather than immediately display it.

em_events()

em_events( $args )

Displays a list of events with fine-grained control over the events shown and their format.

ParameterTypeDefaultDescription
$argsarrayrequiredArray of general, event and location accepted arguments.

em_calendar()

em_calendar( $args )

Displays an HTML calendar populated with events that match the given arguments.

ParameterTypeDefaultDescription
$argsarrayrequiredArray of calendar, general, event and location accepted arguments.

em_locations()

em_locations( $args )

Displays a list of locations that match the given arguments.

ParameterTypeDefaultDescription
$argsarrayrequiredArray of general and location accepted arguments.

em_events_list_grouped()

em_events_list_grouped( $args )

Prints a grouped list of events by year, month, week, or day.

ParameterTypeDefaultDescription
$argsarrayrequiredArray of general, event and location accepted arguments.

em_link( $text = '' )

Creates and prints an HTML link to the events page.

ParameterTypeDefaultDescription
$textstring''Optional link text.

em_rss_link( $text = 'RSS' )

Creates and prints an HTML link to the RSS feed.

ParameterTypeDefaultDescription
$textstring'RSS'Optional link text for the RSS feed.

Forms

tip

If you change the function names below from em_ to em_get_, the function will return the value rather than immediately display it.

em_event_form()

em_event_form( $args = [] )

Outputs the event submission form for guests and members.

ParameterTypeDefaultDescription
$argsarray[]Optional array of arguments to customize the form.

em_events_admin()

em_events_admin( $args = [] )

Outputs a table of events belonging to the user.

ParameterTypeDefaultDescription
$argsarray[]Optional array of arguments to customize the display.

em_event_search_form()

em_event_search_form( $args = [] )

Outputs the event search form.

ParameterTypeDefaultDescription
$argsarray[]Optional array of arguments to customize the search.

em_location_form()

em_location_form( $args = [] )

Outputs the location submission form for guests and members.

ParameterTypeDefaultDescription
$argsarray[]Optional array of arguments to customize the form.

em_locations_admin()

em_locations_admin( $args = [] )

Outputs a table of locations belonging to the user.

ParameterTypeDefaultDescription
$argsarray[]Optional array of arguments to customize the display.

em_location_search_form()

em_location_search_form( $args = [] )

Outputs the location search form.

ParameterTypeDefaultDescription
$argsarray[]Optional array of arguments to customize the search form, see [search form parameters][/search-form/parameters/] for more options.

Conditional Tags

info

Conditional tags all return a boolean value, these are useful in if statements.

Each of these functions may accept parameters to customize the behavior of the conditional check.

em_is_event()

em_is_event( $data, $object_required = false )

Returns whether the given $data represents an event.

ParameterTypeDefaultDescription
$datamixedrequiredThe data to be checked. accepts a number (assumed Post ID), EM_Event, WP_Post or subclass of EM_Object with the post_type matching an event post type,
$object_requiredbooleanfalseSpecifies if an EM Event-type object is required, such as EM_Event.

em_is_location()

em_is_location( $data, $object_required = false )

Returns whether the given $data represents a location.

ParameterTypeDefaultDescription
$datamixedrequiredThe data to be checked. accepts a number (assumed Post ID), EM_Location, WP_Post or subclass of EM_Object with the post_type matching a location post type,
$object_requiredbooleanfalseSpecifies if an EM Event-type object is required, such as EM_Location.

em_are_events_available()

em_are_events_available( $scope = 'future' )

Returns true if there are any events available in the given $scope.

ParameterTypeDefaultDescription
$scopestringfutureThe scope of events to check.

em_is_events_page()

em_is_events_page()

Returns true if the page currently being displayed is the events page.

em_is_event_page()

em_is_event_page()

Returns true if the page currently being displayed is a single event page.

em_is_calendar_day_page()

em_is_calendar_day_page()

Returns true if the page currently being displayed is a single calendar day page.

em_is_category_page()

em_is_category_page( $category = false )

Returns true if the page currently being displayed is a single category page.

ParameterTypeDefaultDescription
$categorymixedfalseOptional category or categories to check against. Accepts an array of term IDs and/or slugs, or a single term ID or slug

em_is_categories_page()

em_is_categories_page()

Returns true if the page currently being displayed is a categories list page.

em_is_tag_page()

em_is_tag_page( $tag = false )

Returns true if the page currently being displayed is a single tag page.

ParameterTypeDefaultDescription
$tagmixedfalseOptional tag/tags to check against. Accepts an array of term IDs and/or slugs, or a single term ID or slug

em_is_location_page()

em_is_location_page()

Returns true if the page currently being displayed is a single location page.

em_is_locations_page()

em_is_locations_page()

Returns true if the page currently being displayed is a locations list page.

em_is_my_bookings_page()

em_is_my_bookings_page()

Returns true if the page currently being displayed is the user's bookings page.

em_is_event_rsvpable()

em_is_event_rsvpable()

Returns true if the current event is RSVPable.