prologuemedia
Member
Posted 3 years ago #
How do you select the x most recent posts and display them via the_loop? I am wanting to create a little summary on the homepage that puts the 3 most recent posts in little boxes along with the title, an image and the first sentence or two. I was going to use the "more" tag to limit the content but, I wasn't sure how to limit the loop output.
-gl
Here's one example to put before your loop:
<?php
if (!is_paged()) {
$my_query = new WP_Query('showposts=3');
while ($my_query->have_posts()) : $my_query->the_post();
the_title();
the_excerpt();
endwhile;
}
?>
Resources:
Stepping Into Template Tags
Stepping Into Templates
Template Hierarchy
The Loop
Template Tags
query_posts()
prologuemedia
Member
Posted 3 years ago #
You are welcome. Marking this resolved.