Skip to content

Instantly share code, notes, and snippets.

@codescribblr
Created February 13, 2014 21:41
Show Gist options
  • Select an option

  • Save codescribblr/8984461 to your computer and use it in GitHub Desktop.

Select an option

Save codescribblr/8984461 to your computer and use it in GitHub Desktop.
Template Finder for Wordpress
add_action( 'wp_head', 'show_me_the_template' );
function show_me_the_template() {
global $template, $current_user, $wp_admin_bar;
get_currentuserinfo();
/* If you have more than one user deny. Be sure to use your user ID! */
if ( !is_user_logged_in() && $current_user->ID != '1' )
return;
if ( is_admin_bar_showing() )
$wp_admin_bar->add_menu( array(
'parent' => false,
'id' => 'template',
'title' => $template,
'href' => '#'
));
else
print_r( $template );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment