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

---

# Display 3 Recent Posts in Single.php

 *  [Josh Mountain](https://wordpress.org/support/users/riboflavin/)
 * (@riboflavin)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/display-3-recent-posts-in-singlephp/)
 * Hi all, I would really appreciate help with this, I have been trying to get it
   to work for weeks. What I am trying to do, is display the 3 latest posts near
   the top of my page in single posts. What I am using is this code:
 *     ```
       <?php $posts = get_posts( "numberposts=3" ); ?>
       <?php if( $posts ) : ?>
       <?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
       <div class="wide3">
       <p><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></p>
       <a href="<?php the_permalink() ?>" class="product">
       <?php echo c2c_get_custom('pic'); ?>
       <span><?php echo c2c_get_custom('price'); ?></span>
       </a>
       </div>
       <?php endforeach; ?>
       <?php endif; ?>
       ```
   
 * This code works great, and displays my 3 latest posts properly, however in the
   main portion of the page, where the current post is suppose to be displayed, 
   it displays the most recent posts rather than the one for this particular single
   page. I guess what I need is a way for it to call the single post again since
   its stuck thinking about most recent posts. Thanks for any help!

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

 *  Thread Starter [Josh Mountain](https://wordpress.org/support/users/riboflavin/)
 * (@riboflavin)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/display-3-recent-posts-in-singlephp/#post-599018)
 * Still need some help with this 🙂
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/display-3-recent-posts-in-singlephp/#post-599019)
 * You may want to read about the use of multiple Loops:
    [The_Loop](http://codex.wordpress.org/The_Loop)

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

The topic ‘Display 3 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/)

 * 2 replies
 * 2 participants
 * Last reply from: [moshu](https://wordpress.org/support/users/moshu/)
 * Last activity: [18 years, 10 months ago](https://wordpress.org/support/topic/display-3-recent-posts-in-singlephp/#post-599019)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
