Using Template Files

Hey! Try out our new documentation pages, hope you like it!

Events Manager was built on the principle of being as flexible as possible.

Whilst you can modify the look and feel of almost any output event information, it is sometimes necessary to use more complex code or integrate some PHP from your theme or another plugin. Whatever the reason, it is now possible to simply insert specific files into your theme which will override certain aspects of Events Manager.

Events Manager uses templates from within the plugin folder to format things like calendars, event pages, event registration forms, etc. and therefore, when it calls these templates, it first checks to see whether it should use the same one from your theme instead. This folder is called templates:

To override any of these files, you should place the file you want to modify within the same folder structure in one of these folders starting from, not including the first templates folder:

  • wp-content/plugin-templates/events-manager
  • wp-content/themes/parent-theme/plugins/events-manager
  • wp-content/themes/child-theme/plugins/events-manager

The above also shows the order of precedence, so if you override the same file in multiple places, the file in your child theme will take precedence over the parent theme and the plugin-templates folder respectively.

Here’s a visual example:

If these folders don’t exist in your theme or the wp-content folder, create them.

Example – Overriding the Calendar HTML

We’ll give you a common example, using the above folder structures,  which override the calendar. This file is located at wp-content/plugins/events-manager/templates/templates/calendar-day.php.

Rather than editing this file directly, copy it to wp-content/plugin-templates/events-manager/templates/calendar-day.php and edit it there, as it will not be overwritten when you update Events Manager.

Note that Events Manager has two template folder levels, the one inside contains common templates, but other folders within the parent templates folder can be overridden. If you’re copying over a file from templates/templates, that’ll need to go within a templates folder in the overriding folder destination, as per the screenshot above.

Pro Templates

Events Manager Pro also makes use of templates for its own features. In this case, the concept is exactly the same, except you need to refer to the folder in events-manager-pro/templates to find the templates you’re after, and put them in a separate folder at the same level as the events-manager folder you’ve created as per the examples above.

Note that you’re creating a new folder aside from events-manager here, you don’t put the events-manager-pro folder inside the events-manager folder; they remain alongside each other (assuming you have an events-manager folder, not required)

Which folder should I choose?

This largely depends on your needs, but generally speaking, we recommend putting it in the wp-content/plugin-templates/events-manager folder. The reason is that if you ever update your theme, your changes don’t get overwritten, whereas this folder doesn’t get overwritten by any updates to any part of your installation.

If you’re designing a theme from scratch or a child theme and Events Manager theming is integrated within your theme, then it may make sense to add it to your theme folder.

If you previously had your overriding files in one place, you can move it at any time to any of the possible template locations without consequence. Just remember that you should move it, because if you copy over your files from your theme to the wp-content/plugin-templates folder, EM will still use the files from your theme.

More Common Mistakes

Wrong folder path – Files within the templates folder are not put within wp-content/themes/your-theme/plugins/events-manager/templates/templates/ – note the extra templates folder in this path compared to the previous one.

Don’t copy all the files – whilst we do our utmost to keep changes on the templates to a minimum, we’re regularly adding features that sometimes require us to change the default templates slightly to allow this new functionality. If you copy files you don’t need to modify, they will unnecessarily override potentially updated files in the plugin folder and cause conflicts.