Hi there,
I have been searching for a clean solution for the following:
On my frontpage I want to show one (the most recent) post per category.
If I have five categories I would like to list 5 posts (one per category.)
Can anyone offer advice how to do this in the loop??
The link MichaelH supplied doesn't offer the flexibility to 'play' with the layout.
What I've now done is used the 'loop' below and specified the category id's I wanted to show an article of.
<?php
query_posts("cat=15&showposts=1");
if (have_posts()) : while (have_posts()) : the_post();
?>
<b>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></b>
<p><?php the_content(''); ?></p>
<div class="hppostmeta">
<p><?php the_date('l, F j, Y'); ?> | " rel="bookmark">Read the story ยป</p>
</div>
<?php endwhile; else: ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
<?php endif; ?>
This works fine with just one problem:
When I use the loop above more than once in my homepage the date is only show correctly the first time..
any pointers?
The_Loop - see the multiple loops section.