Advertisement
BakerMan

Untitled

Feb 11th, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_action( 'admin_notices', 'tribe_temp_debug_test' );
  2.  
  3. function tribe_temp_debug_test() {
  4.     $query = new WP_Query( array(
  5.         'post_status' => 'any',
  6.         'posts_per_page' => 1,
  7.         'meta_key' => '_EventStartDate',
  8.         'category_name' => 'Events'
  9.     ));
  10.  
  11.     echo '<p> </p><strong> Debug information </strong> ';
  12.  
  13.     if ( 0 === count( $query->posts ) ) echo 'Nothing found';
  14.     else {
  15.         $post = array_shift($query->posts);
  16.         echo ' ID=' . $post->ID;
  17.         echo ' | TYPE=' . $post->post_type;
  18.  
  19.         $categories = get_the_terms( $post->ID, 'category' );
  20.         $terms = '';
  21.         if ( is_array( $categories ) ) {
  22.             foreach ( $categories as $cat ) $terms .= $cat->name . ' ';
  23.         }
  24.         echo ' | TERMS=' . $terms;
  25.  
  26.         $meta = get_post_meta( $post->ID );
  27.         $fields = '';
  28.         foreach ( $meta as $key => $value ) $fields .= $key . ':' . $value . ' ';
  29.         $fields = empty( $fields ) ? 'None' : $fields;
  30.         echo ' | FIELDS=' . $fields;
  31.     }
  32.     echo '</p>';
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement