Scroll Down
/**
* code #15 - output the current post/page template name in your header area
* source - http://wordpress.stackexchange.com/a/3848/8922
*/
function display_template_name() {
global $template;
print_r($template);
}
add_action('wp_head', 'display_template_name');
This small block of code is more useful when debugging than anything else. But there are often times when I’m building a template and I cannot figure out why one page is rendering different than all the others. This usually relates to a template type issue, especially with custom post types.
Just add this bit into your functions.php file for a couple of seconds, enough time to pull down your results. When you reload the page you’ll notice the PHP print_r() method directly outputs the content into your HTML. Be sure to remove this after using, or just comment out the block to hide it with /* */ syntax.