Output which theme template file a post/page is using in the header of WordPress

By Fábio Zaffani How ToThemesWordpress at 20 de February de 2013

This is a tip to help developers when creating or editing a WordPress template. This is a dead simple code and is especially useful for big templates (like a magazine style or e-commerce). It will show which template are being currently used by WordPress.

add_action('wp_head', 'show_template');
function show_template() {
    global $template;
    print_r($template);
}