Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexstandiford/d15f950f304c290f6fbaab23d5000820 to your computer and use it in GitHub Desktop.
Save alexstandiford/d15f950f304c290f6fbaab23d5000820 to your computer and use it in GitHub Desktop.
Injects a plugin directory into The Events Calendar Template Location checks
<?php
//Inject Events Calendar template controls in this plugin
add_filter('tribe_events_template', function($file, $template){
$override_template = TKGEM_ROOT_DIR.'tribe-events/'.$template;
$theme_template = trailingslashit(get_stylesheet_directory()).'tribe-events/'.$template;
if(file_exists($override_template) && !file_exists($theme_template)){
$file = TKGEM_ROOT_DIR.'tribe-events/single-event.php';
}
return $file;
}, 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment