Title: Same comments on every post
Last modified: August 20, 2016

---

# Same comments on every post

 *  [pmbs](https://wordpress.org/support/users/pmbs/)
 * (@pmbs)
 * [15 years ago](https://wordpress.org/support/topic/same-comments-on-every-post-2/)
 * Hello there,
 * As the topic title states I’ve got a problem with the comments. Problem is simple:
   the same comments turns up on every post. Not good, eh.
 * So far the only thing I can imagine would screw it up would be… some of the other
   php-codes in single.php. As a rookie, I really don’t know, but could it be some
   issue with the foreach command somehow? Anyone able to point me in the right 
   direction?
 * Any help much appriciated.
 * PS: Installed the Disqus-plugin, works fine, but same problem – same comments.

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

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years ago](https://wordpress.org/support/topic/same-comments-on-every-post-2/#post-2095290)
 * Have you tried:
 * – deactivating **all** plugins to see if this resolves the problem. If this works,
   re-activate the plugins one by one until you find the problematic plugin(s).
 * – switching to the Twenty Ten theme to rule out any theme-specific problems.
 * – [resetting the plugins folder](http://codex.wordpress.org/FAQ_Troubleshooting#How_to_deactivate_all_plugins_when_not_able_to_access_the_administrative_menus.3F)
   by FTP or PhpMyAdmin. Sometimes, an apparently inactive plugin can still cause
   problems.
 *  Thread Starter [pmbs](https://wordpress.org/support/users/pmbs/)
 * (@pmbs)
 * [15 years ago](https://wordpress.org/support/topic/same-comments-on-every-post-2/#post-2095291)
 * Thanks for the tips. Probably should have done those before asking, huh.
 * Anyhow, problem lies within the template then. Because with Twenty Ten comments
   would stay with the unique post (Disqus had some problems loading on this theme,
   allthough).
 * So template problem.. now what? 😮
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years ago](https://wordpress.org/support/topic/same-comments-on-every-post-2/#post-2095295)
 * Unless you are really comfortable working with PHP and HTML, I’d suggest looking
   for another theme.
 *  Thread Starter [pmbs](https://wordpress.org/support/users/pmbs/)
 * (@pmbs)
 * [15 years ago](https://wordpress.org/support/topic/same-comments-on-every-post-2/#post-2095298)
 * Yea, well, thing is this is my own-developed theme. Just have to try to figure
   out where the PHP-conflict could be.
 * Still, if anyone else did run into the same; yell out.
 *  Thread Starter [pmbs](https://wordpress.org/support/users/pmbs/)
 * (@pmbs)
 * [15 years ago](https://wordpress.org/support/topic/same-comments-on-every-post-2/#post-2095401)
 *     ```
       <?php
       $args = array( 'numberposts' => 9, 'order'=> 'DESC', 'orderby' => 'post_date' );
       $postslist = get_posts( $args );
       foreach ($postslist as $post) :  setup_postdata($post); ?>
       <div id="hoyrebar-tittel-wrap">
       <a href="<?php the_permalink() ?>"><?php if (strlen($post->post_title) > 27) {
       echo substr(the_title($before = '', $after = '', FALSE), 0, 27) . '..'; } else {
       the_title();
       } ?>
               <?php endforeach; ?>
       ```
   
 * This is the code that screws up the comments (removing it – comments works fine).
   
   Anyone can rewrite this so it won’t collide?
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years ago](https://wordpress.org/support/topic/same-comments-on-every-post-2/#post-2095410)
 * try and save the `$post` object into a `$temp` variable, for instance, before
   your code section, and restore it after:
 *     ```
       <?php $temmp = $post; //save $post object;
       $args = array( 'numberposts' => 9, 'order'=> 'DESC', 'orderby' => 'post_date' );
       $postslist = get_posts( $args );
       foreach ($postslist as $post) :  setup_postdata($post); ?>
       <div id="hoyrebar-tittel-wrap">
       <a href="<?php the_permalink() ?>"><?php if (strlen($post->post_title) > 27) {
       echo substr(the_title($before = '', $after = '', FALSE), 0, 27) . '..'; } else {
       the_title();
       } ?>
               <?php endforeach;
       $post = $temp; //restore $post object; ?>
       ```
   
 *  Thread Starter [pmbs](https://wordpress.org/support/users/pmbs/)
 * (@pmbs)
 * [15 years ago](https://wordpress.org/support/topic/same-comments-on-every-post-2/#post-2095413)
 * alchymyth, thanks alot! Working as a charm! 😀
 * Allthough, now, after I’ve changed my permalinks to %posttitle% Disqus-plugin
   wont load comments.. Arrgh. Another thing to figure out.
 *  [hungit](https://wordpress.org/support/users/hungit/)
 * (@hungit)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/same-comments-on-every-post-2/#post-2095756)
 * Since 3.0, you only need call `<?php wp_reset_postdata(); ?>` after your looping.
 * Hope this help 🙂

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

The topic ‘Same comments on every post’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 4 participants
 * Last reply from: [hungit](https://wordpress.org/support/users/hungit/)
 * Last activity: [14 years, 6 months ago](https://wordpress.org/support/topic/same-comments-on-every-post-2/#post-2095756)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
