How to display the latest 6 posts (one post from each category only)
-
Hi there,
I have about 8 categories in my blog and I want display the latest 6 post on the homepage, but I want each post come from different category, what I have is this:
<?php
$my_query = new WP_Query(‘showposts=6’);
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate = $post->ID;
?><h3 id=”post-<?php the_ID(); ?>”>” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></h3>
<?php endwhile; ?>
but the above code will display multiple posts from the same category, can someone please help me with this?
Thanks a lot!
- The topic ‘How to display the latest 6 posts (one post from each category only)’ is closed to new replies.