The calendar views that are available with The Events Calendar can be customized by overriding the templates and creating a copy of the template in your theme..

There are a couple of things that are important to note about the calendar views templates, as they are using a new engine that relies heavily on which the plugin originally created the template instance. So when you are talking about calendar views, you are looking at Event-related namespacing for your theme files.

Examples from Plugin to Theme loading path:

  • the-events-calendar/src/views/v2/list/event.php ➡️ /tribe/events/v2/list/event.php
  • events-pro/src/views/v2/photo/event.php ➡️ /tribe/event-pro/v2/photo/event.php

We included a way for third-party developers to add their own custom folders to our plugins, but once those add-ons kick in, they will change which namespace we will load.

Example:

  • Original file:
    events-pro/src/views/v2/photo/event.php ➡️ /tribe/event-pro/v2/photo/event.php
  • Overwritten by custom plugin path:
    my-plugin/custom/v2/photo/event.php ➡️ /tribe/my-plugin/v2/photo/event.php

If you are looking for simple one-to-one customization of a given template you should not be using this code, you should instead look at a couple of other documentation articles we have on our website:

The code below is the simplest example of adding custom plugin paths to The Events Calendar. Important to note that if you don’t want to overwrite the namespace from Event, you can comment out that argument/index on your folder addition.

<?php
/**
 * Add your own plugin as a template override location for The Events Calendar, Event Tickets, and related plugins.
 * This only applies to templates using the new Template Engine, as of version 5.0.1 that include Updated Views and Blocks.
 *
 * Each custom array's `path` is whatever you want it to be (i.e. customizable) up until the 'v2' part of each
 * template's override path.
 *
 * So if the The Events Calendar location for a view is:
 *     /wp-content/plugins/the-events-calendar/src/views/v2/list/event/featured-image.php
 *
 * Then this plugin's override location would be:
 *     /wp-content/plugins/MY-PLUGIN/tribe-customizations/v2/list/event/featured-image.php
 *
 * And the theme's override location would be:
 *     /wp-content/themes/YOUR-CHILD-THEME/tribe/my-plugin/v2/list/event/featured-image.php
 *
 * FYI: Parent/Child Themes will override this custom plugin's override. Use your own custom code with the
 *      `tribe_template_theme_path_list` filter instead of this snippet to trump theme overrides if you must, but that is not
 *      typical best practice, although it may be necessary in order to override a theme that comes with V2 Views overrides
 *      (e.g. Avada) that you want to override.
 *
 * @link https://theeventscalendar.com/knowledgebase/k/custom-additional-template-locations/
 *
 * @see  \Tribe__Template::get_template_path_list()
 * @see  \Tribe__Template::get_template_folder()
 *
 * @param array            $folders  Array of data for loading locations.
 * @param \Tribe__Template $template Instance of the template engine we are working with.
 *
 * @return array
 */
function tribe_v2_additional_plugin_template_locations( $folders, \Tribe__Template $template ) {
	// Which file namespace your plugin will use.
	$plugin_name = 'my-plugin';

	// Which order we should load your plugin files at.
	$priority = 5;
	// Plugin in which the file was loaded from = 20
	// Events Pro = 25
	// Tickets = 17

	// Which folder in your plugin the customizations will be loaded from.
	$custom_folder[] = 'tribe-customizations';

	// Builds the correct file path to look for.
	$plugin_path = array_merge(
		(array) trailingslashit( plugin_dir_path( __FILE__ ) ),
		(array) $custom_folder,
		array_diff( $template->get_template_folder(), [ 'src', 'views' ] )
	);

	/**
	 * Examples:
	 *
	 * src/views/v2/list.php -> my-plugin/tribe-customizations/v2/list.php
	 * src/views/v2/list/event/cost.php -> my-plugin/tribe-customizations/v2/list/event/cost.php
	 * src/views/v2/photo/event/cost.php -> my-plugin/tribe-customizations/v2/photo/event/cost.php
	 * src/views/v2/organizer/meta/details/phone.php -> my-plugin/tribe-customizations/v2/organizer/meta/details/phone.php
	 */

	/*
	 * Custom loading location for overwriting file loading.
	 */
	$folders[ $plugin_name ] = [
		'id'        => $plugin_name,
		'namespace' => $plugin_name, // Only set this if you want to overwrite theme namespacing
		'priority'  => $priority,
		'path'      => $plugin_path,
	];

	return $folders;
}

add_filter( 'tribe_template_path_list', 'tribe_v2_additional_plugin_template_locations', 10, 2 );