Title: Same content for different posts in single.php
Last modified: August 30, 2016

---

# Same content for different posts in single.php

 *  [Kris](https://wordpress.org/support/users/omgb/)
 * (@omgb)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/same-content-for-different-posts-in-singlephp/)
 * Hi there, I got a bit of an issue with all my posts displaying the same content
   after adding a small loop to the sidebar.
    Here’s my single.php code: `<?php //
   Exit if accessed directly if ( !defined('ABSPATH')) exit;
 * get_header(); ?>
    <div class="container"> <!-- SIDEBAR LEFT --> <div class="red
   left">Latest
 * <?php $posts = get_posts('numberposts=3&offset=0');
    foreach ($posts as $post):
   start_wp(); ?>
 * </b></span></div></div></div>
 * </div><?php endforeach; ?>
 *  </div></div>
 * <!-- SIDEBAR LEFT END -->
 *  <div class="blue2">
 *  <div class="box"><p class="tit" style="margin-left:0px;margin-top:0px;margin-
   bottom:10px;"><?php the_title(); ?></p>
 * <?php the_content(); ?></div></div></div>
 * <?php get_footer(); ?>
 * What do I do wrong?

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

 *  Thread Starter [Kris](https://wordpress.org/support/users/omgb/)
 * (@omgb)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/same-content-for-different-posts-in-singlephp/#post-6221812)
 * exporting it to sidebar.php doesnt change anything either.
 * moving the ‘latest posts’ sidebar below `<?php the_content(); ?>` gets rid of
   the issue. if worse comes to worst i guess i could position it from there, but
   there must be easier solution…
 * thanks in advance
 *  Thread Starter [Kris](https://wordpress.org/support/users/omgb/)
 * (@omgb)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/same-content-for-different-posts-in-singlephp/#post-6221813)
 * oh just noticed my sidebar didnt paste properly
 *     ```
       <!-- SIDEBAR LEFT -->
           <div class="red left">Latest<br/><br/>
   
       <?php $posts = get_posts('numberposts=3&offset=0');
       foreach ($posts as $post) : start_wp(); ?>
   
             <div style="width:190px; height: 170px;margin-bottom:7px;"><div><a href="<?php the_permalink() ?>"><?php if ( has_post_thumbnail() ) { the_post_thumbnail( '190x110' ); } ?></a><div><div><span class="title"><b><a href="<?php the_permalink() ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="bookmark" ><?php the_title(); ?></a></b></span></div></div></div>
   
       </div><?php endforeach; ?>  
   
           </div></div>      
   
       <!-- SIDEBAR LEFT END -->
       ```
   
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/same-content-for-different-posts-in-singlephp/#post-6221834)
 * after the `endforeach;` make sure to end your sidebar code with:
 * `wp_reset_postdata();`

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

The topic ‘Same content for different posts in single.php’ is closed to new replies.

## Tags

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

 * 3 replies
 * 2 participants
 * Last reply from: [Michael](https://wordpress.org/support/users/alchymyth/)
 * Last activity: [10 years, 11 months ago](https://wordpress.org/support/topic/same-content-for-different-posts-in-singlephp/#post-6221834)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
