Title: Recent Post Loop
Last modified: August 19, 2016

---

# Recent Post Loop

 *  Resolved [Saint Jermaine](https://wordpress.org/support/users/saint-jermaine/)
 * (@saint-jermaine)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/recent-post-loop/)
 * Hi guys,
 * I have a self-hosted WordPress Blog and I’m having a problem showing more than
   one recent post in my sidebar.
 * Here is the code I’m using to display my most recent blog post in my sidebar–
 *     ```
       <h4>Latest Post</h4>
   
       			<?php query_posts("post_per_page=3"); the_post(); ?>
   
       			<div class="sidebar-post">
       				<p class="date"><?php the_date(); ?></p>
       				<p><img src="<?php echo get_post_meta($post->ID, "Thumbnail", true);?>" /></p>
       				<h5><a>"><?php the_title(); ?></a></h5>
       				<p><?php the_excerpt(); ?></p>
       			</div>
   
       			<?php wp_reset_query(); ?>
       ```
   
 * _[please use backticks or the ‘code’ button to [mark code](http://codex.wordpress.org/Forum_Welcome#Posting_Code);
   it will keep the code intact.
    you can already see that the link html got corrupted
   by posting code the wrong way.]
 * It works fine, except that no matter what number I put in the “post_per_page=
   3”, it only returns one post. I would like to display at least 3 recent posts.
   Can anyone help?
 * Thanks a lot!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/recent-post-loop/#post-1977650)
 * it is actually the plural: ‘posts_per_page’
 * also, you need a loop structure after the query:
 *     ```
       <?php query_posts("posts_per_page=3"); while( have_posts() ) : the_post(); ?>
       ```
   
 * and then at the end:
 *     ```
       <?php endwhile;
       wp_reset_query(); ?>
       ```
   
 *  Thread Starter [Saint Jermaine](https://wordpress.org/support/users/saint-jermaine/)
 * (@saint-jermaine)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/recent-post-loop/#post-1977709)
 * That worked perfectly. Thank you so much!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Recent Post Loop’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Saint Jermaine](https://wordpress.org/support/users/saint-jermaine/)
 * Last activity: [15 years, 3 months ago](https://wordpress.org/support/topic/recent-post-loop/#post-1977709)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
