WordPress - 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 ); } add_action( 'wp_head', 'show_me_the_template' );
Add this quick snippet to your themes functions.php file to display the current page that you are working on template's file name in the admin bar of your WordPress Site. Makes it really easy to figure out what file the change has to be made in.
*Word of Caution: Doesn't necessarily show you the exact file if you use a feature heavy theme like something off of ThemeForest, that is built with OOP and many functions but it will definitely give you at least a general idea on those kinds of themes

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.