Guest User

Untitled

a guest
Jan 23rd, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. <?php
  2.  
  3. class QueryDebugBarPanel
  4. extends Debug_Bar_Panel {
  5.  
  6. function title( $title = null ) {
  7. return 'Query';
  8. }
  9.  
  10. function render() {
  11. global $wp_query;
  12.  
  13. $vars = [];
  14. foreach ( $wp_query->query_vars as $key => $value ) {
  15. if ( empty( $value ) ) {
  16. continue;
  17. }
  18. $vars[] = sprintf( '<tr><td>%s</td><td>%s</td></tr>', $key, print_r( $value, true ) );
  19. }
  20.  
  21. $props = [];
  22. foreach ( get_object_vars( $wp_query ) as $key => $value ) {
  23. if ( empty( $value ) ) {
  24. continue;
  25. }
  26. $props[] = sprintf( '<tr><td>%s</td><td>%s</td></tr>', $key, print_r( $value, true ) );
  27. }
  28.  
  29. $vars = implode( PHP_EOL, $vars );
  30. $props = implode( PHP_EOL, $props );
  31.  
  32. include __DIR__ . '/template.php';
  33. }
  34. }
Add Comment
Please, Sign In to add comment