V1 Template Customization Example

👋 This article covers Views 1 (V1), the legacy design of calendar views prior to The Events Calendar 5 and Events Calendar Pro 5. If you are using newer versions, please check out the customization example for the updated templates in 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: /wp-content/plugins/the-events-calendar/src/views.

Here’s a look inside that folder:

Screenshot of the folder containing the template files for The Events Calendar.

The 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:

<!-- Event meta -->
<!--?php do_action( 'tribe_events_single_event_before_the_meta' ) ?-->
<!--?php tribe_get_template_part( 'modules/meta' ); ?-->
<!--?php do_action( 'tribe_events_single_event_after_the_meta' ) ?-->

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:

Ah, the 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 tribe-events.

Screenshot of a theme folder with the tribe-events folder in it.

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 tribe-events:

  • One called modules
  • Another one inside of that one called meta
Screenshot of the tribe-events folder with a modules folder that has another folder called meta which contains the details.php file.

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.

Table of Contents

Details

Report an issue