Last active
July 28, 2019 07:14
-
-
Save hmbashar/e07c3358a0320b3ce0deeb8d8bbcef99 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// force use of templates from plugin folder | |
function cpte_force_template( $template ) | |
{ | |
if( is_archive( 'events' ) ) { | |
$template = WP_PLUGIN_DIR .'/'. plugin_basename( dirname(__FILE__) ) .'/archive-events.php'; | |
} | |
if( is_singular( 'events' ) ) { | |
$template = WP_PLUGIN_DIR .'/'. plugin_basename( dirname(__FILE__) ) .'/single-events.php'; | |
} | |
return $template; | |
} | |
add_filter( 'template_include', 'cpte_force_template' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment