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.
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.
All of these functions below the $args variable can be an array or query-string with any event accepted arguments.
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 )
em_events( $args )
Displays a list of events with fine-grained control over the events shown and their format.
Parameter | Type | Default | Description |
---|---|---|---|
$args | array | required | Array of general, event and location accepted arguments. |
em_calendar()
em_calendar( $args )
em_calendar( $args )
Displays an HTML calendar populated with events that match the given arguments.
Parameter | Type | Default | Description |
---|---|---|---|
$args | array | required | Array of calendar, general, event and location accepted arguments. |
em_locations()
em_locations( $args )
em_locations( $args )
Displays a list of locations that match the given arguments.
Parameter | Type | Default | Description |
---|---|---|---|
$args | array | required | Array of general and location accepted arguments. |
em_events_list_grouped()
em_events_list_grouped( $args )
em_events_list_grouped( $args )
Prints a grouped list of events by year, month, week, or day.
Parameter | Type | Default | Description |
---|---|---|---|
$args | array | required | Array of general, event and location accepted arguments. |
Links
em_link()
em_link( $text = '' )
em_link( $text = '' )
Creates and prints an HTML link to the events page.
Parameter | Type | Default | Description |
---|---|---|---|
$text | string | '' | Optional link text. |
em_rss_link()
em_rss_link( $text = 'RSS' )
em_rss_link( $text = 'RSS' )
Creates and prints an HTML link to the RSS feed.
Parameter | Type | Default | Description |
---|---|---|---|
$text | string | 'RSS' | Optional link text for the RSS feed. |
Forms
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 = [] )
em_event_form( $args = [] )
Outputs the event submission form for guests and members.
Parameter | Type | Default | Description |
---|---|---|---|
$args | array | [] | Optional array of arguments to customize the form. |
em_events_admin()
em_events_admin( $args = [] )
em_events_admin( $args = [] )
Outputs a table of events belonging to the user.
Parameter | Type | Default | Description |
---|---|---|---|
$args | array | [] | Optional array of arguments to customize the display. |
em_event_search_form()
em_event_search_form( $args = [] )
em_event_search_form( $args = [] )
Outputs the event search form.
Parameter | Type | Default | Description |
---|---|---|---|
$args | array | [] | Optional array of arguments to customize the search. |
em_location_form()
em_location_form( $args = [] )
em_location_form( $args = [] )
Outputs the location submission form for guests and members.
Parameter | Type | Default | Description |
---|---|---|---|
$args | array | [] | Optional array of arguments to customize the form. |
em_locations_admin()
em_locations_admin( $args = [] )
em_locations_admin( $args = [] )
Outputs a table of locations belonging to the user.
Parameter | Type | Default | Description |
---|---|---|---|
$args | array | [] | Optional array of arguments to customize the display. |
em_location_search_form()
em_location_search_form( $args = [] )
em_location_search_form( $args = [] )
Outputs the location search form.
Parameter | Type | Default | Description |
---|---|---|---|
$args | array | [] | Optional array of arguments to customize the search form, see [search form parameters][/search-form/parameters/] for more options. |
Conditional Tags
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 )
em_is_event( $data, $object_required = false )
Returns whether the given $data
represents an event.
Parameter | Type | Default | Description |
---|---|---|---|
$data | mixed | required | The 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_required | boolean | false | Specifies if an EM Event-type object is required, such as EM_Event . |
em_is_location()
em_is_location( $data, $object_required = false )
em_is_location( $data, $object_required = false )
Returns whether the given $data
represents a location.
Parameter | Type | Default | Description |
---|---|---|---|
$data | mixed | required | The 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_required | boolean | false | Specifies if an EM Event-type object is required, such as EM_Location . |
em_are_events_available()
em_are_events_available( $scope = 'future' )
em_are_events_available( $scope = 'future' )
Returns true
if there are any events available in the given $scope
.
Parameter | Type | Default | Description |
---|---|---|---|
$scope | string | future | The scope of events to check. |
em_is_events_page()
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()
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()
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 )
em_is_category_page( $category = false )
Returns true
if the page currently being displayed is a single category page.
Parameter | Type | Default | Description |
---|---|---|---|
$category | mixed | false | Optional 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()
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 )
em_is_tag_page( $tag = false )
Returns true
if the page currently being displayed is a single tag page.
Parameter | Type | Default | Description |
---|---|---|---|
$tag | mixed | false | Optional 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()
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()
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()
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()
em_is_event_rsvpable()
Returns true
if the current event is RSVPable.