Last active
August 29, 2015 14:14
-
-
Save thefrosty/e01dc0cc06cd16498c1c to your computer and use it in GitHub Desktop.
Which WordPress tempalte are you currently one? http://wp.me/p4gJ2a-Be
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ap_show_template() { | |
// bail early | |
if ( is_admin() || !is_user_logged_in() ) | |
return; | |
if ( !is_admin_bar_showing() || !current_user_can( 'edit_files' ) ) | |
return; | |
global $template, $wp_admin_bar; | |
$title = ( isset( $template ) ) ? str_replace( array( get_template_directory(), get_stylesheet_directory() ), '', $template ) : 'Unknown'; | |
$wp_admin_bar->add_node( array( | |
'parent' => false, | |
'id' => 'template', | |
'title' => $title, | |
'href' => '#' | |
) ); | |
// optional add number queries under the template | |
$wp_admin_bar->add_node( array( | |
'parent' => 'template', | |
'id' => 'queries', | |
'title' => sprintf( esc_attr( '%s queries in %s sec' ), get_num_queries(), timer_stop() ), | |
'href' => '#' | |
) ); | |
} | |
add_action( 'admin_bar_menu', 'ap_show_template', 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
quicker way to check admin perms?