Shortcodes
A shortcode is a tag in square brackets that WordPress replaces with content when the page is shown. Events Manager registers shortcodes for lists of events and locations, calendars, maps, search forms, the event submission form and a few links. You can put them in any post, page or text widget, and in the block editor with the Shortcode block.
If you build pages in the block editor, the Events Manager blocks cover the most common lists and the calendar without a shortcode. For help choosing, see How events appear on your site.
How shortcodes work
A shortcode has a name and, optionally, attributes that filter or change what it shows:
[events_list scope="future" limit="5" category="5"]
The list shortcodes accept the search attributes, so one shortcode can be narrowed by date range, category, tag, location, country and more. Values are always in quotes. Yes or no attributes take 1 or 0.
Format the output with placeholders
Most shortcodes can wrap a format: HTML and placeholders between an opening and a closing tag. Each event, location, category or tag in the result is printed with that format.
[events_list limit="5"]<p>#_EVENTLINK, #_EVENTDATES at #_LOCATIONNAME</p>[/events_list]
When you leave the format out, Events Manager uses the default format for that kind of list from Events then Settings then Formatting.
In the block editor, put a shortcode that contains HTML in a Shortcode block or a Custom HTML block, so the editor doesn't alter the markup. In the classic editor, use the Text tab.
A format can also be passed as an attribute, for example format_header="<ul>". On a new install these three attributes are ignored until you set Allow format shortcode parameters? to Yes in Events then Settings then General then Admin Tools (Advanced). Sites that were upgraded from a version older than this option kept them switched on. A format written between the tags works either way. See Shortcode security.
Event Shortcodes
events_list
[events_list] shows events that match the attributes you give it. With no attributes it shows upcoming events, soonest first, up to the number set in Event List Limits (Events then Settings then Pages then Event List/Archives, 10 by default).
[events_list scope="tomorrow" country="US"]
<p>#_EVENTLINK takes place at #_LOCATIONLINK on #_EVENTDATES, #_EVENTTIMES</p>
[/events_list]
This lists tomorrow's events in the United States, one paragraph each.
The default list format, as printed by this shortcode on the demo site's home page.
Useful attributes, all optional:
| Attribute | Default | What it does |
|---|---|---|
scope | Default List Scope setting (future events) | The date range: future, past, today, tomorrow, month, next-month, all, a date, or two dates separated by a comma. The full list is in the search attributes. |
limit | Event List Limits setting | How many events to show. 0 shows them all. |
pagination | 0 | Set to 1 to add page links when there are more events than limit. |
orderby, order | Default event list ordering setting | The fields to sort by, and ASC or DESC. |
category, tag | all | One or more IDs or slugs, separated by commas. |
location | all | One or more location IDs. |
groupby | none | Shows one event per group, for example the next date of each recurring event. See Grouping and ordering lists. |
Choosing a view
The same search can be shown as a list, a grid, a grouped list, a map or a calendar. Set it with view:
| Attribute | Default | What it does |
|---|---|---|
view | list | list: a list of events.list-grouped: events under date headings, by day, week, month or year. Takes the mode and date_format attributes of [events_list_grouped].grid: a grid of cards, using the grid formats in Events then Settings then Formatting then Events.map: a map of the matching events that have a physical location.calendar: a month calendar, which also takes the calendar attributes. |
has_search | 0 | Set to 1 to put the search form above the results, so visitors can filter them. |
views | View Types setting | The views a visitor can switch between when has_search is on, separated by commas, for example list,grid,map. |
[events_list view="grid" has_search="1" views="list,grid,calendar"]
With has_search="1" the shortcode also accepts the search form parameters, so you can hide or relabel individual search fields for that one list.
The grid view. The button at the right of the search bar switches between the views you allow.
[events_list_grouped] and [events_map] below are shorthand for [events_list view="list-grouped"] and [events_list view="map"].
events_list_grouped
[events_list_grouped] lists events under date headings. It accepts everything [events_list] does, plus:
| Attribute | Default | What it does |
|---|---|---|
mode | Grouped list default setting (Monthly on a new site) | How to split the list: yearly, monthly, weekly or daily. |
date_format | Grouped list format setting (F Y on a new site) | The date in each heading, as a PHP date format. |
[events_list_grouped mode="monthly" category="5"]
This shows upcoming events in category 5 under a heading for each month.
A grouped list in monthly mode.
The HTML of each heading comes from Grouped list header (<h2>#s</h2> on a new site, where #s is the date). All three settings are in Events then Settings then Formatting then Events under Grouped Lists View. A grouped list is always in date order, whatever orderby says.
event
[event] shows one event. Give it the event's post ID with post_id, or its Events Manager event ID with event:
[event post_id="123"]<strong>#_EVENTNAME</strong> starts at #_EVENTTIMES on #_EVENTDATES.[/event]
Without a format between the tags it prints the whole Single event page format.
Inside an event's own description you can leave the ID out, and the shortcode uses the event it is in. That is a way to use placeholders in a description: [event]Doors open at #_12HSTARTTIME[/event].
If the visitor could not open the event's own page (a draft, a pending or a private event), the shortcode prints nothing.
events_map
[events_map] shows a map with a marker for each location that has a matching event. It is the same as [events_list view="map"], and takes the event search attributes, so you can map this month's events or one category. For a map of locations whether or not they have events, use [locations_map].
[events_map scope="month" category="5" width="100%" height="400"]
It accepts the width, height and map_style attributes described under [locations_map]. Maps need Google Maps to be set up first, see Google Maps.
event_form
[event_form] shows the form that lets visitors or members submit events from the front end. Who can use it, and what happens to a submitted event, is covered in Event submission forms.
[event_form]
Location Shortcodes
Location shortcodes are available while Enable locations? is set to Yes in Events then Settings then General then General Options.
locations_list
[locations_list] shows locations that match the attributes you give it. It accepts the location and general search attributes, and location placeholders in its format.
<ul>
[locations_list eventful="1" scope="future" country="US"]<li>#_LOCATIONLINK, #_LOCATIONTOWN</li>[/locations_list]
</ul>
This lists locations in the United States that have an upcoming event. eventful="1" leaves out locations with no events in the scope.
The view, has_search and views attributes work as they do for [events_list]. Locations can be shown as list, grid or map, and the search form shows the location fields only.
[locations_list view="grid" has_search="1" views="list,grid"]
location
[location] shows one location. Give it the location's post ID with post_id, or its Events Manager location ID with location:
[location post_id="123"]#_LOCATIONNAME is at #_LOCATIONFULLLINE.[/location]
Without a format it prints the Single location page format. A location that isn't published, or is password protected, prints nothing.
locations_map
[locations_map] shows a map with a marker for each matching location. It accepts the location and general search attributes, and these:
| Attribute | Default | What it does |
|---|---|---|
width | Default map width setting (400px) | A number of pixels or a percentage, such as 450 or 100%. |
height | Default map height setting (300px) | A number of pixels or a percentage. |
map_style | none | A base64-encoded JSON map style. See Google Maps. |
[locations_map country="US" width="100%" height="400"]
Clicking a marker opens a balloon. Its content comes from Location balloon format under Global Map Format in Events then Settings then Formatting then Maps, which is editable once Advanced Mode is on for the map formats.
Maps need Google Maps to be set up first, see Google Maps. The older spelling [locations-map] still works, but use [locations_map] in new content.
Category Shortcodes
categories_list
[categories_list] lists event categories. Use category placeholders in the format. It accepts orderby, order, limit and pagination, and the arguments of the WordPress WP_Term_Query class, such as hide_empty.
<ul>
[categories_list hide_empty="0"]<li>#_CATEGORYLINK</li>[/categories_list]
</ul>
This lists every category as a link, including those with no events. The default order and limit come from Events then Settings then Pages then Event Categories.
event_category
[event_category] shows one category. The category attribute takes the category's ID, which is the tag_ID number in the address bar when you edit the category in Events then Event Categories. A slug or a name is not accepted here.
[event_category category="5"]<h3>#_CATEGORYNAME</h3>#_CATEGORYNEXTEVENTS[/event_category]
Without a format it prints the Single category page format.
Tag Shortcodes
tags_list
[tags_list] lists event tags, and works like [categories_list] with tag placeholders.
<ul>
[tags_list hide_empty="0"]<li>#_TAGLINK</li>[/tags_list]
</ul>
event_tag
[event_tag] shows one tag. The tag attribute takes the tag's ID, found the same way as a category ID.
[event_tag tag="12"]<h3>#_TAGNAME</h3>#_TAGNEXTEVENTS[/event_tag]
Calendar Shortcodes
events_calendar
[events_calendar] shows a month calendar. Visitors move between months with the arrows, and click a day or an event for details. Sizes, styles and previews are explained in Using event calendars.
[events_calendar calendar_size="large" long_events="1" category="5" month="1" year="2027"]
This shows a large calendar of category 5, opening on January 2027, with events that last several days drawn across each day they cover.
It accepts the event search attributes and the calendar attributes. The ones used most:
| Attribute | Default | What it does |
|---|---|---|
calendar_size | Default calendar size setting | small, medium or large. Leave it out for a calendar that changes size with the space it has. |
calendar_event_style | Default event style setting | pill, dot, dots or ring. See event styles. |
long_events | Show Long Events? setting | 1 shows an event on every day it covers, 0 only on its first day. |
limit | Calendar events/day limit setting (3) | The most events shown on one day. |
month, year | the current month | The month the calendar opens on. |
scope | all | future hides past events and stops visitors going back before the current month. |
has_search | 0 | 1 adds a filter button to the calendar header that opens the search form. |
The calendar on the demo site's Calendar page.
The older full="1" attribute no longer sets the size. Use calendar_size="large".
events_gcal
[events_gcal] prints a Google Calendar button that subscribes the visitor to your iCal feed of all events.
[events_gcal]
The image is loaded from Google. To use your own, pass its address: [events_gcal img="https://example.com/add-to-calendar.png"].
Search Form Shortcodes
event_search_form
[event_search_form] shows the event search form on its own, with no list under it. Results open on your events page, so a page must be chosen for Events page in Events then Settings then Pages then Event List/Archives. [events_search] is another name for the same shortcode.
[event_search_form]
It accepts the search form parameters. To show a form together with its results on the same page, use [events_list has_search="1"] instead. The form and its settings are described in Event search form.
location_search_form
[location_search_form] shows the search form for locations: text, geolocation and the country, region, state and town filters. [locations_search] is another name for it. Results open on your locations page.
[location_search_form]
Booking Shortcodes
my_bookings
[my_bookings] shows a logged-in visitor the bookings they have made, with links to cancel where you allow it. It takes no attributes. The usual way to offer this is to choose a page for My bookings page in Events then Settings then Pages then Other Pages, which needs no shortcode. See My Bookings.
[my_bookings]
The withdrawal form for EU distance-selling rules has its own shortcode, [em_withdrawal_form], described in Right of withdrawal.
Link Shortcodes
These print a link or an address, for use inside your own text.
| Shortcode | Prints | Example |
|---|---|---|
[events_link] | A link to your events page. Text between the tags becomes the link text. Without it, the link reads "Events". | [events_link]See what's on[/events_link] |
[events_url] | The address of your events page, as plain text. | <a href="[events_url]" class="button">Events</a> |
[events_rss_link] | A link to the events RSS feed. The link text is "RSS" unless you set text. | [events_rss_link text="Subscribe by RSS"] |
[events_rss_url] | The address of the events RSS feed, as plain text. | [events_rss_url] |
[events_rss_link] takes its link text from the text attribute, not from text between the tags.
Troubleshooting
The shortcode shows as plain text
The name is misspelled, or the plugin that provides it is not active. Location shortcodes also stop working when locations are disabled. Check the spelling against this page: it is [event_search_form], for example, and [events_search_form] does not exist.
My HTML format is ignored or shows as text
Write the format between the opening and closing tags instead of in a format attribute, and add it in a Shortcode or Custom HTML block (or the Text tab of the classic editor) so the editor doesn't convert the tags. If the HTML still shows as text, see the decoding options in Shortcode security.
The list shows fewer events than I expect
A list shows future events only, and stops at the Event List Limits number. Add scope="all" for past events as well, and limit="0" or pagination="1" to get past the limit. Cancelled events are hidden unless Include cancelled events? is Yes in Events then Settings then Pages then Event List/Archives.
event_category or event_tag prints nothing
These two need the numeric ID. category="music" prints nothing, category="5" works.