Advertisement
Guest User

Afficher page en cours sur WP

a guest
Jul 30th, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. <?php
  2.  
  3. if(!is_admin()){
  4.  
  5. function define_current_theme_file( $template ) {
  6. $GLOBALS['current_theme_template'] = basename($template);
  7. return $template;
  8. }
  9.  
  10. add_action('template_include', 'define_current_theme_file', 1000);
  11.  
  12. function create_node_toolbar($wp_admin_bar) {
  13.  
  14. global $wp_admin_bar;
  15.  
  16. $debug_args = array(
  17. 'id' => 'debug_php_tools',
  18. 'title' => 'PHP tools',
  19. 'parent' => false
  20. );
  21.  
  22. $current_file_args = array(
  23. 'id' => 'current_file',
  24. 'title' => 'Current theme file : ' . $GLOBALS['current_theme_template'],
  25. 'parent' => 'debug_php_tools'
  26. );
  27.  
  28. $current_post_type = array(
  29. 'id' => 'current_post_type',
  30. 'title' => 'Current Post type : ' . get_post_type(),
  31. 'parent' => 'debug_php_tools'
  32. );
  33.  
  34. $number_queries_args = array(
  35. 'id' => 'num_queries',
  36. 'title' => get_num_queries().' queries in '. timer_stop(0) .' seconds',
  37. 'parent' => 'debug_php_tools'
  38. );
  39.  
  40. $wp_admin_bar->add_node($debug_args);
  41. $wp_admin_bar->add_node($current_file_args);
  42. $wp_admin_bar->add_node($current_post_type);
  43. $wp_admin_bar->add_node($number_queries_args);
  44. }
  45.  
  46. add_action( 'admin_bar_menu', 'create_node_toolbar', 999 );
  47. }
  48.  
  49. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement