Hi, on the home page of a site I'm currently working on, I want to display the most recent post from each of several featured categories, restricted to 10 posts total but only one post from each of the categories.
I have a home.php with a query_posts statement before the loop, which displays the featured categories properly; the problem is it goes more than one post deep into each category. Is there a way to get only the most recent post for each cat? Is query_posts best here or some other function?
Here's some code:
<!-- ?php query_posts('cat=10,9,8,7,6,5,4,3,2,1&showposts=10'); ? --> <?php while (have_posts()) : the_post(); ?> -- display post using the_excerpt and the_thumbnail -- <?php endwhile; ?> <?php wp_reset_query(); ?>
Obviously, this displays posts from featured categories (great), but shows the 10 most recent posts from all of them (not what I need). Showposts=1 will only show one post total.
I've also tried variations on cat=10&showposts=1,cat=9&showposts=1, etc, but that's off-base.
I don't care about pagination in this instance, just the 10 featured categories.
I've been all over the codex page for query_posts and unless I've missed something I can't find a solution. I've tried several ways, including making the post categories sub-cats of a parent cat. The problem is that showposts restricts the total number of posts displayed.
This is my first post to the forums, apologies if this has been covered and I didn't find it, and for any snafus in my code display.
Any thoughts? Thanks.