Using Template Files
Most of what Events Manager prints on the front end comes from PHP template files in the plugin's templates folder. You can replace any one of them with your own copy, kept outside the plugin, so your changes survive plugin updates.
Reach for a template file when the change needs PHP or a different HTML structure. If you only want to change which details are shown and in what order, edit the formats in Events then Settings then Formatting with placeholders instead. If you want to add something to a template without replacing it, an action or filter is usually less work to maintain.
You need file access to wp-content (SFTP, SSH or your host's file manager) and enough PHP to read the template you are changing.
Where Events Manager looks for a template
Each time a template is needed, Events Manager checks these places in order and uses the first copy it finds:
| Order | Location | Use it when |
|---|---|---|
| 1 | wp-content/themes/your-child-theme/plugins/events-manager/ | The change belongs to a child theme. |
| 2 | wp-content/themes/your-theme/plugins/events-manager/ | You build and maintain the theme yourself. |
| 3 | wp-content/plugin-templates/events-manager/ | Every other case. Theme updates and theme switches don't touch this folder. |
| 4 | wp-content/plugins/events-manager/templates/ | The plugin's own copy, used when no override exists. |
Create the folders if they don't exist. You can move an override from one location to another at any time. Move it, don't copy it: if the same file exists in two places, the one higher in the table wins.
Override a template
-
Find the file in
wp-content/plugins/events-manager/templates/. The folder list below says what each folder holds. -
Copy it to one of the override locations, keeping the path that follows the plugin's first
templatesfolder. The plugin has atemplatesfolder insidetemplates, so files from there keep onetemplatesfolder in the override path:wp-content/plugins/events-manager/templates/templates/events-list.phpwp-content/plugin-templates/events-manager/templates/events-list.phpwp-content/plugins/events-manager/templates/placeholders/bookingform.phpwp-content/plugin-templates/events-manager/placeholders/bookingform.phpwp-content/plugins/events-manager/templates/forms/bookingform/tickets-list.phpwp-content/plugin-templates/events-manager/forms/bookingform/tickets-list.php -
Edit your copy. Keep the
class,idandnameattributes that are already there, because the plugin's JavaScript and CSS rely on them. -
Load a page that uses the template and confirm your change shows. If it doesn't, see Troubleshooting.
Templates change between releases as features are added. An override keeps serving your old copy, so a file you copied and never edited can hide a new feature or break one. After each plugin update, compare your overrides with the new originals.
Template folders
These are the folders inside events-manager/templates/ in version 7.5.
| Folder | What it holds |
|---|---|
templates/ | Whole views: events-list.php, events-grid.php, events-list-grouped.php, events-calendar.php, calendar-day.php, event-single.php, location-single.php, locations-list.php, locations-grid.php, category-single.php, categories-list.php, tag-single.php, tags-list.php, map-global.php, my-bookings.php, events-search.php, locations-search.php, ical.php, rss.php, withdrawal-form.php, bookings-event-printable.php, and the online event pages event-location-join.php and event-location-embed.php. |
templates/search/ | The parts of the search form: the main bar (form-main.php), the advanced search (form-advanced.php and its inline and modal variants), and one file per field, such as scope.php, categories.php, tags.php, geo.php and location-countries.php. |
calendar/ | The calendar: calendar.php, the header and date sections, and the preview modal and tooltip. |
placeholders/ | The output of the larger placeholders: bookingform.php, bookingbutton.php, attendees.php, attendeeslist.php, attendeespendinglist.php, categories.php, eventtags.php, eventcategoriesimages.php, locationmap.php. |
forms/ | The front-end event and location editors (event-editor.php, location-editor.php and their parts in event/ and location/), the booking form parts in bookingform/, the ticket editor, and the time range fields in timeranges/. Some of the event/ parts are also used by the admin editor. |
formats/ | The default text of every format in Events then Settings then Formatting, one file per setting. See Format files. |
emails/ | The booking summary and ticket tables used in emails (bookingsummary.php, bookingtickets.php). |
tables/ | The event and location tables on the front-end management pages. |
buddypress/ | BuddyPress profile and group pages. |
Format files
Each file in formats/ is named after its setting with the dbem_ prefix removed, so formats/single_event_format.php supplies the Single event page format. While Advanced Mode is disabled in Events then Settings then Formatting, which is the default, every format is read from these files, and an override in your formats/ folder replaces it.
When Advanced Mode is enabled, the format groups you choose to customize are read from the settings page and the rest still come from the files. With Super Advanced Mode, all formats come from the settings and the files are ignored.
To force one format to come from its file whatever the mode, add its option name through the em_formats_filter filter:
add_filter( 'em_formats_filter', function ( $formats ) {
$formats[] = 'dbem_event_list_item_format';
return $formats;
} );
Change a template without replacing it
Every template loaded by Events Manager fires an action before and after it, named after the template's path:
do_action( 'em_template_before_' . $template_name, $args );
// the template is included here
do_action( 'em_template_after_' . $template_name, $args );
$template_name is the path you would use for an override, including .php. This prints a notice above every event list and needs no template copy:
add_action( 'em_template_before_templates/events-list.php', function ( $args ) {
echo '<p class="my-events-notice">' . esc_html__( 'All times are local to the venue.', 'my-plugin' ) . '</p>';
} );
Two filters cover the remaining cases. em_locate_template_args_{template_name} changes the variables passed to a template, and em_locate_template changes which file is loaded. Both are listed in Hooks and filters.