Skip to content

Instantly share code, notes, and snippets.

@elimn
Last active September 22, 2015 14:05
Show Gist options
  • Select an option

  • Save elimn/60364baa828edaeca245 to your computer and use it in GitHub Desktop.

Select an option

Save elimn/60364baa828edaeca245 to your computer and use it in GitHub Desktop.
MT | TEC | Set a custom page template for specific pages
<?php
/*
* Set a custom page template for specific pages within The Events Calendar
*/
function tribe_theme_template_chooser ( $template ) {
if ( ! tribe_is_event() ) return $template;
/*
* Example for changing the template for the single-event page to custom-page-template.php
* Template is usually set to /plugins/the-events-calendar/src/views/default-template.php
* You might wish to include some things from that template in your custom one, such as
* the function tribe_get_view() which helps format the content within your template.
* You can modify this example to set the template for any tribe page. Month view could be
* modified by instead using the tribe_is_month() condition.
*/
// Single event page
if ( is_single() ) {
$template = locate_template( 'custom-page-template.php' );
}
return $template;
}
add_filter( 'template_include', 'tribe_theme_template_chooser', 11 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment