I used this code in functions on my TwentyTen child sites to show (in the source code) which template was being used.
I just tried this with my TwentyTwelve child theme, and no luck. :( Any chance anyone here know what to change to make it work in Twenty Twelve?
It is very handy.
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'];
}