Title: Recent posts loop
Last modified: August 19, 2016

---

# Recent posts loop

 *  [substitute](https://wordpress.org/support/users/substitute/)
 * (@substitute)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/recent-posts-loop-1/)
 * Hi
 * For some reasons I can’t get my theme to display my latest posts correctly, so
   I figure I’d do a page with my latest posts.
    I found this code to create a loop
   to do so, but it returns an empty page. What else should I do apart from creating
   a new page template with that loop inside? Thanks
 *     ```
       <h3>Recent Articles</h3>
       <ul>
       <?php
           $recentPosts = new WP_Query();
           $recentPosts->query('showposts=5');
       ?>
       <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
           <li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li>
       <?php endwhile; ?>
       </ul>
       ```
   

Viewing 16 replies (of 16 total)

[←](https://wordpress.org/support/topic/recent-posts-loop-1/?output_format=md) [1](https://wordpress.org/support/topic/recent-posts-loop-1/?output_format=md)
2

 *  Thread Starter [substitute](https://wordpress.org/support/users/substitute/)
 * (@substitute)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/recent-posts-loop-1/page/2/#post-1338409)
 * Well this took toooooo long so I just used my brain and made a category-page 
   with January 2010 and it’ll serve as my latest posts page for the time being 
   and will force me to update it once a month.

Viewing 16 replies (of 16 total)

[←](https://wordpress.org/support/topic/recent-posts-loop-1/?output_format=md) [1](https://wordpress.org/support/topic/recent-posts-loop-1/?output_format=md)
2

The topic ‘Recent posts loop’ is closed to new replies.

## Tags

 * [loop](https://wordpress.org/support/topic-tag/loop/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 16 replies
 * 3 participants
 * Last reply from: [substitute](https://wordpress.org/support/users/substitute/)
 * Last activity: [16 years, 5 months ago](https://wordpress.org/support/topic/recent-posts-loop-1/page/2/#post-1338409)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
