👋 This article covers Legacy Views (V1). If you are using the updated design of calendar views that shipped in The Events Calendar 5 and Events Calendar Pro 5., please check out the Template Customization Example (V2).
The Events Calendar allows you to customize any of the calendar views, including events, venues and organizers. It uses template overrides, which is a way of modifying templates without touching the source code of the plugins and add-ons. If you’re unsure what templates overrides are or how they work, then you’ll want to read up on it before proceeding.
We’re going to look at an example of a template override. In this case, we’re going to customize the event template, which is used for the layout of event pages. So, when you visit your calendar and click on an event, that’s the view we’re talking about.
Let’s say we really like the Venue and Organizer information below the event description, but want to remove the Details.
Here’s how we can make that happen.
Locate the template file
First off, we need to find where the event template file is located in the plugin files. In this case, we’re customizing a template in The Events Calendar. That means we can head over here to start looking:
Here’s a look inside that folder:
single-event.php file appears to be the most relevant template we’re looking for, so let’s open that up in a code editor. Somewhere around Line 69 is this block of code:
&amp;amp;amp;amp;lt;!-- Event meta --&amp;amp;amp;amp;gt; &amp;amp;amp;amp;lt;!--?php do_action( 'tribe_events_single_event_before_the_meta' ) ?--&amp;amp;amp;amp;gt; &amp;amp;amp;amp;lt;!--?php tribe_get_template_part( 'modules/meta' ); ?--&amp;amp;amp;amp;gt; &amp;amp;amp;amp;lt;!--?php do_action( 'tribe_events_single_event_after_the_meta' ) ?--&amp;amp;amp;amp;gt;
That’s not the code for the event details we’re looking for, but it does tell us where it’s located:
modules/meta. Let’s go back to the plugin folder and follow that path. Here’s what we see:
details.php file! That’s what we’re looking for. Let’s make a copy of it and save it on our desktop for safekeeping while we tackle the next step.
Add a new folder to your theme
The key part of overriding a template is that we need a place to put our customized template. That’s what we’re going to do next.
Head over to your server and open up your theme folder. That’s located where WordPress is installed in the
/wp-content/themes folder. Your theme will be in there, so let’s open it up and add a new folder in it called
Not bad so far? Let’s move to the next step.
Add your copied template file to the tribe-events folder
Seems pretty straightforward, right? But there’s a little more detail involved here.
If we were simply talking about the
single-event.php file we opened first, then we could have copied it and dropped it directly in the
tribe-events folder we created in the theme. Instead, we’re dealing with a template within a template — in other words,
single-event.php contains the
details.php file we want to customize and it’s located in a different folder.
No problem! We will create more folders in the
tribe-events folder so that it matches what is in the plugin files. That means adding two more folders to
- One called
- Another one inside of that one called
Still with us? Let’s get into some code!
Customize the template
Now that the
details.php file is safely in our theme, we can modify it to suit our needs. In this case, we want to remove the Details section of the event information. That means we can open up the file and literally erase everything in it. Seriously, select everything and delete it until you’re left with a blank file, then save your work.
Here’s what we get when we revisit the event page:
Heck yeah, the Details section has been removed, which is exactly what we want! Although this is a fairly simple example of what’s possible with template overrides, the same process applies for every other template file in The Events Calendar and all of its add-ons.