WP_Query problems with custom post type
-
I’m really getting mad down here…I am trying to output the latest 5 posts of my 4 CPT with a specific category but still I don’t get any output.
Here is what I’m doing:
<?php global $wp_query; $wp_query = new WP_Query( array( 'post_type' => array( 'wuelfrath' , 'mettmann', 'haan', 'neanderland' ), 'showposts' => 5, 'category_name' => array( 'kurz-notiert-neanderland' , 'kurz-notiert-mettmann', 'kurz-notiert-haan', 'kurz-notiert-wuelfrath' ) ) ); if (have_posts()) : while (have_posts()) : the_post(); ?> <article> <?php if (get_comments_number()==0) { } else { ?> <div class="comment-bubble"><?php $id = get_the_ID(); $comments_count = wp_count_comments( $id ); echo $comments_count->approved; ?></div> <?php } ?> <span class="stream-shortys-date-time"><?php the_time('D. d.m.y'); ?></span> <span class="stream-shortys-city"><?php $post_type = get_post_type_object( get_post_type($post) ); echo $post_type->label ; ?></span> <a href="<?php the_permalink(); ?>" rel="bookmark"><h3 class="stream-shortys-headline"><?php the_title(); ?></h3></a> </article> <hr class="divider-smaller"> <?php endwhile; endif; wp_reset_query(); ?>
Am I doing things wrong?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘WP_Query problems with custom post type’ is closed to new replies.