** Summary **
- Default templates live in the
event-organiser/templates
folder. Do not edit them there, copy them into your theme first. archive-events.php
,single-events.php
,taxonomy-event-category.php
,taxonomy-event-venue.php
are the ‘page templates’- There are templates for the event list widgets and shortcodes
- There are templates for the booking form and ticket selection.
Basic Overview
Do not make changes to these files. Any changes will be lost when Event Organiser updates. Instead, to customize or over-ride these templates, make a copy of these files in your theme directory and edit these.
When WordPress is serving up content it needs to now how to display it – and this of course depends on what the content is. Events will, typically, need to be displayed differently to blog posts. Event Organiser therefore provides default templates to display relevant event information.
However, the templates cannot work with all themes. In any case you will probably want to change what information is displayed and where. Event Organiser gives you complete control of this by allowing you to edit the templates. In fact you’re encouraged to customize these templates to fit better into your theme, suit your needs and get the most out of this plug-in!
Event Organiser uses various template files, located in the template sub-folder of the plug-in’s folder. Usually: ...wp-content/event-organiser/templates/
.
Template Files
Below is a list of the default templates, and their purpose.
Template | What its used for | Role | Since |
---|---|---|---|
Event page | single-event.php |
No longer used. This is just an example template; by default Event Organiser will use single.php for an event page and inject event-meta-single-event.php into it. You can over-ride that by adding a single-event.php template to your theme |
1.0 |
Event Information (on event page) | event-meta-single-event.php |
Not part of the template hierarchy. Used to display event information (e.g., is included by single-event.php ) |
1.7 |
Event archives | archive-event.php |
The template for displaying listings of events (including the day, year & month pages). | 1.0 |
Event venue page | taxonomy-event-venue.php |
The template for displaying listings of events at a particular venue. | 1.3 |
Event category page | taxonomy-event-category.php |
The template for displaying listings of events of some category. | 1.0 |
Event tag page | taxonomy-event-tag.php |
The template for displaying listings of events of some tag. | 1.2 |
Event list shortcode | shortcode-event-list.php |
Not part of the template hierarchy. Used to display the [[eo_events]] shortcode. |
1.7 |
Event list widget | widget-event-list.php |
Not part of the template hierarchy. Used to display the events list widget. | 1.7 |
Developers
Event Organiser intercepts the template at the template_include
hook. If an ‘appropriate’ template has not been found (in either the child or parent theme) it uses the corresponding default templates (unless template handling has been turned off).
‘Appropriateness’ is determined by the template name (i.e. archive-event.php
) and fully respects the template template-hierarchy. For instance, you can use venue and category specific templates in your theme by creating templates of the form: taxonomy-event-venue-{$venue_slug}.php
.
Be sure to name the template file correctly, if Event Organiser cannot find an ‘event’ template file in the theme directory it will use the plug-in defaults. You can prevent this behavior in the plug-in settings (In your WordPress admin: Settings > Event Organiser). If the templates are disabled, WordPress decides what template file to use according to the template hierarchy – of course, in general, these will not display event dates / venues / categories etc.
Templates Not Functioning Correctly?
The default templates should function correctly with most themes. If you are experiencing errors, you can do one of two things:
- Replace the templates by making your own copy in your theme directory (see above)
- Disable the template pages – this means WordPress will decide what template page to use, according to the template hierarchy, but in general this won’t display event dates / venues / categories for example, since these templates would be intended for general posts which don’t have the corresponding information associated with them.
Why Isn’t This A Bug?
The default templates, even if they do work ‘as is’ with your theme are intended to be replaced by your own themes. Each website has its own needs and rather than trying to pre-empt that or provide an overwhelming ‘cockpit’ of options to edit the templates, the plug-in provides basic templates which you can easily replace. This gives you the complete freedom to decide what you want to display, where and how.
Unfortunately the default templates can’t work with all themes (one size doesn’t fit all). This isn’t a bug with either the plug-in or the theme.