Skip to content

Instantly share code, notes, and snippets.

@jasontucker
Created November 17, 2012 07:42
Show Gist options
  • Save jasontucker/4094074 to your computer and use it in GitHub Desktop.
Save jasontucker/4094074 to your computer and use it in GitHub Desktop.
Display template name of the page you are currently on at the top of the page.
//WordPress uses a variable $template to store the template being used. Therefore, for debugging (not recommended for a live site), you can put this in your theme's functions.php:
add_action('wp_head', 'show_template');
function show_template() {
global $template;
print_r($template);
}
@brandondove
Copy link

There's also a hook for changing the template that's being included for bonus points.

add_filter( 'template_include', 'bd_change_template' );
function bd_change_template( $template ) {
print_r( $template );
return $template;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment