SHOW:
|
|
- or go back to the newest paste.
| 1 | - | /** |
| 1 | + | |
| 2 | - | * This code should be added temporarily to your theme's functions.php file |
| 2 | + | |
| 3 | - | * (or you could set it up within its own plugin) ... please remove after |
| 3 | + | |
| 4 | - | * testing. |
| 4 | + | |
| 5 | - | */ |
| 5 | + | |
| 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 | - | var_dump( $query->posts ); |
| 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 | } |