Skip to content

Instantly share code, notes, and snippets.

@seafarer
Created April 23, 2014 21:56
Show Gist options
  • Select an option

  • Save seafarer/11233822 to your computer and use it in GitHub Desktop.

Select an option

Save seafarer/11233822 to your computer and use it in GitHub Desktop.
What template is in use on wp page?
<?php
add_filter( 'template_include', 'var_template_include', 1000 );
function var_template_include( $t ){
$GLOBALS['current_theme_template'] = basename($t);
return $t;
}
function get_current_template( $echo = false ) {
if( !isset( $GLOBALS['current_theme_template'] ) )
return false;
if( $echo )
echo $GLOBALS['current_theme_template'];
else
return $GLOBALS['current_theme_template'];
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment