Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(!is_admin()){
- function define_current_theme_file( $template ) {
- $GLOBALS['current_theme_template'] = basename($template);
- return $template;
- }
- add_action('template_include', 'define_current_theme_file', 1000);
- function create_node_toolbar($wp_admin_bar) {
- global $wp_admin_bar;
- $debug_args = array(
- 'id' => 'debug_php_tools',
- 'title' => 'PHP tools',
- 'parent' => false
- );
- $current_file_args = array(
- 'id' => 'current_file',
- 'title' => 'Current theme file : ' . $GLOBALS['current_theme_template'],
- 'parent' => 'debug_php_tools'
- );
- $current_post_type = array(
- 'id' => 'current_post_type',
- 'title' => 'Current Post type : ' . get_post_type(),
- 'parent' => 'debug_php_tools'
- );
- $number_queries_args = array(
- 'id' => 'num_queries',
- 'title' => get_num_queries().' queries in '. timer_stop(0) .' seconds',
- 'parent' => 'debug_php_tools'
- );
- $wp_admin_bar->add_node($debug_args);
- $wp_admin_bar->add_node($current_file_args);
- $wp_admin_bar->add_node($current_post_type);
- $wp_admin_bar->add_node($number_queries_args);
- }
- add_action( 'admin_bar_menu', 'create_node_toolbar', 999 );
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement