Posted By

bitsculptor on 10/13/12


Tagged

wordpress templates


Versions (?)

Template Finder for Wordpress


 / Published in: PHP
 

This will show you what template you are currently viewing (index.php, page.php)

  1. add_action( 'wp_head', 'show_me_the_template' );
  2. function show_me_the_template() {
  3. global $template, $current_user, $wp_admin_bar;
  4.  
  5. get_currentuserinfo();
  6. /* If you have more than one user deny. Be sure to use your user ID! */
  7. if ( !is_user_logged_in() && $current_user->ID != '1' )
  8. return;
  9. if ( is_admin_bar_showing() )
  10. $wp_admin_bar->add_menu( array(
  11. 'parent' => false,
  12. 'id' => 'template',
  13. 'title' => $template,
  14. 'href' => '#'
  15. ));
  16. else
  17. print_r( $template );
  18. }

Report this snippet  

You need to login to post a comment.