I’m using a loop to generate the slides I need for a Coda Slider slideshow. The slides should be pulling the most recent post from 5 different categories. The problem I’m having is that it’s pulling the 5 most recent posts from the 5 categories collectively and not individually. So it’s pulling 2 posts from the 1st category and then 1 from each of the others.
Any way to get this to work properly?
This is the code I’m using:
<?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>
* slide content *
</div>
<?php endwhile; ?>
For those who were interested in an answer to this question, I found the answer myself.
The original foreach loop code came from this post:
http://wordpress.org/support/topic/display-most-recent-post-from-each-of-several-categories-on-home-page