I cooked this up … It may be useful as a plugin? Any interest as a plugin, give me a shout … eric pecoraro _at_ shepard dot com
It involves some overhead, so it would obviously be used for development only. Not tested thoroughly, but it works on my system.
<?php
// this can live in /themes/mytheme/functions.php, or maybe as a dev plugin?
function get_template_name () {
foreach ( debug_backtrace() as $called_file ) {
foreach ( $called_file as $index ) {
if ( !is_array($index[0]) AND strstr($index[0],'/themes/') AND !strstr($index[0],'footer.php') ) {
$template_file = $index[0] ;
}
}
}
$template_contents = file_get_contents($template_file) ;
preg_match_all("(Template Name:(.*)\n)siU",$template_contents,$template_name);
$template_name = trim($template_name[1][0]);
if ( !$template_name ) { $template_name = '(default)' ; }
$template_file = array_pop(explode('/themes/', basename($template_file)));
return $template_file . ' > '. $template_name ;
}
?>
Useage (in /themes/mytheme/footer.php would work)
<?php
if (is_user_logged_in()) {
echo ' | '. get_template_name() ;
}
?>