Return to Snippet

Revision: 50623
at August 29, 2011 06:17 by jeremyjared74


Initial Code
<?php
add_action( 'wp_head', 'admin_print_template_used' );
  function admin_print_template_used() {
  global $template, $current_user, $wp_admin_bar;
  get_currentuserinfo();
  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 );
}
// START THE SCRIPT TO PUSH ADMIN BAR TO BOTTOM
	function fb_move_admin_bar() {
    echo '
<style type="text/css">
  body {
  padding-bottom: 28px;
  }
  body.admin-bar #wphead {
     padding-top: 0;
  }
  body.admin-bar #footer {
     padding-bottom: 28px;
  }
  #wpadminbar {
      top: auto !important;
      bottom: 0;
  }
  #wpadminbar .quicklinks .menupop ul {
      bottom: 28px;
  }
</style>';
}
// on backend area
add_action( 'admin_head', 'fb_move_admin_bar' );
// on frontend area
add_action( 'wp_head', 'fb_move_admin_bar' );
?>

Initial URL

                                

Initial Description
Add this to the functions.php file. Make sure the Admin Bar is set to show when viewing site. You will see in the Admin Bar the current page template that is being used.

Initial Title
Print Current WordPress Template Being Used

Initial Tags
template, wordpress

Initial Language
PHP