Loop and display most recent post from multiple categories
-
I’ve seen responses for this, but they either don’t function properly or don’t quite answer my question.
I’m trying to use a loop to create slides for a slideshow. Each slide shows the most recent post from 5 different categories. The below code works, except that it’s showing the 5 most recent posts from all categories and not each category. ie., it shows 2 posts from category 7 and the 4 following most recent categories.
My guess is that a foreach statement should work, but I keep getting stuck. Help!
<?php $cat_post_query = new WP_Query($query_string . 'cat=7,8,10,9,11'); while ($cat_post_query->have_posts()) : $cat_post_query->the_post(); $do_not_duplicate = $post->ID;?> <div> * post content* </div> <?php endwhile; ?>
- The topic ‘Loop and display most recent post from multiple categories’ is closed to new replies.