Title: Display Recent Posts in Single.php
Last modified: August 18, 2016

---

# Display Recent Posts in Single.php

 *  [Josh Mountain](https://wordpress.org/support/users/riboflavin/)
 * (@riboflavin)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/display-recent-posts-in-singlephp/)
 * Hi all!
 * I use this code on my homepage to display recent posts made on my site. I wanted
   to use this code to display recent posts on single pages as well, but when I 
   use it, it only displays the current post rather than the latest posts. I’m sure
   I am just doing something wrong with the loop but I can’t figure it out. Any 
   help is **really** appreciated!
 *     ```
       <?php while (have_posts()) : the_post(); ?>
       <div class="wide3">
       <a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
       <a href="<?php the_permalink() ?>" class="product">
       <?php echo c2c_get_custom('pic'); ?>
       <span><?php echo c2c_get_custom('price'); ?></span>
       </a>
       </div>
       <?php endwhile; ?>
       ```
   

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

 *  Thread Starter [Josh Mountain](https://wordpress.org/support/users/riboflavin/)
 * (@riboflavin)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/display-recent-posts-in-singlephp/#post-534731)
 * Still looking for some assistance with this, thanks!
 *  Thread Starter [Josh Mountain](https://wordpress.org/support/users/riboflavin/)
 * (@riboflavin)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/display-recent-posts-in-singlephp/#post-535077)
 * Would still really appreciate any help, thanks!
 *  Thread Starter [Josh Mountain](https://wordpress.org/support/users/riboflavin/)
 * (@riboflavin)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/display-recent-posts-in-singlephp/#post-535095)
 * Ok, I changed my first loop line to this:
 * `<?php query_posts('showposts=3'); while (have_posts()) : the_post(); ?>`
 * and now it displays the 3 most recent posts in the header properly, however now
   the main post on the page is being displayed as the most recent post. How do 
   I set it back to display the proper post for the single page?
 * Thanks!
 *  [Adam Brown](https://wordpress.org/support/users/adamrbrown/)
 * (@adamrbrown)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/display-recent-posts-in-singlephp/#post-535096)
 * You’re trying to call the loop twice on the same page, but for different posts.
   That’s not going to work the way you want it to.
 * If you’re just trying to display recent posts in the sidebar, are you using the
   Sidebar Widgets plugin? That would make your life easier.
 *  [Chris_K](https://wordpress.org/support/users/handysolo/)
 * (@handysolo)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/display-recent-posts-in-singlephp/#post-535097)
 * Or have a look at [wp_get_archives()](http://codex.wordpress.org/Template_Tags/wp_get_archives)
   maybe?
 *  Thread Starter [Josh Mountain](https://wordpress.org/support/users/riboflavin/)
 * (@riboflavin)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/display-recent-posts-in-singlephp/#post-535098)
 * With wp_get_archives can I still pull custom values such as
 * `<?php echo c2c_get_custom('pic'); ?>`

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

The topic ‘Display Recent Posts in Single.php’ is closed to new replies.

## Tags

 * [posts](https://wordpress.org/support/topic-tag/posts/)
 * [recent](https://wordpress.org/support/topic-tag/recent/)
 * [single](https://wordpress.org/support/topic-tag/single/)

 * 6 replies
 * 3 participants
 * Last reply from: [Josh Mountain](https://wordpress.org/support/users/riboflavin/)
 * Last activity: [19 years, 2 months ago](https://wordpress.org/support/topic/display-recent-posts-in-singlephp/#post-535098)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
