all posts have the same comments.. HELP (6 posts)

  1. centro
    Posted 7 years ago #

    hello all, first post here. im having a hell of a time trying to get these comments to work. what happens is, all my comments on different posts show the same comments from a specific post with in id of 6.

    on my single.php ive echo'd out the_ID() from within the loop and get the correct post.

    in my comments template ive echo'd out $post->ID and always get an id == 6. i have no idea why.

    any ideas? im kind of lost as to what to do here, irc has been less than helpful even at peak hours. /sigh

  2. na3s
    Posted 7 years ago #

    I have this same issue, and cannot locate the source. I was using a comment callback in order to customize the appearance of comments. (listed pings and comment separate) I was sure this was the issue, but when I uploaded the 'default' comment.php and reverted my customization, the error still persists.

    My template is 100% from scratch, custom work for a client. I have a feeling this may be caused by a plugin ... if I discover anything I will post back here.

  3. na3s
    Posted 7 years ago #

    Weird. An echo of $post->ID before the_content() yields expected results, but if I echo $post->ID after the_content(), it gives me the 'phantom' ID of a particular post on every page, ID=468. This is the ID that the comments are using, and why all comments posted are posted to this page.

    My first suspect is get_posts and/or query_posts corrupting the loop, but there are no get_posts/query_posts on within this template, or ran at all before the loop.

    Is it possible that there's some problems with the_content()? Anybody have a solution, or any ideas what may be causing this?

  4. na3s
    Posted 7 years ago #

    I was using Custom Widgets Plugin, Disabling this plugin worked for me, but it is likely that it wasn't the plugin, probably the custom widgets that I did create.

  5. Victor Edier
    Posted 7 years ago #

    na3s was right when says something its corrumping the loop, there are two ways to fixit
    the problem occurs when any another query_post from any reason is useit before comments_template()

    if (have_posts()) : while (have_posts()) : the_post();
    $temporal = $post->ID;
    another query_post from any reason
    $post->ID = $temporal;

    so with a temporal fix that issue, the other way its to use a instance for the query $my_query = new WP_Query().

  6. taiguey
    Posted 6 years ago #

    victoredier: thank you, merci, gracias, choukran, obrigado ouffff spent hours and hours seraching for this: http://www.el-guanabanero.org small village citizen newspaper has now comments working!!!

Topic Closed

This topic has been closed to new replies.

About this Topic