WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] query_posts() breaks comments_template() (3 posts)

  1. Innovine
    Member
    Posted 5 years ago #

    I have included comments_template() in my Loop, as I want the front page of my blog to show all the recent comments. I've noticed however that if I add query_posts('showposts=10'); before the loop, the comments stop working (the add comment link just reloads the main page)

    This does not occur if I take the index.php code and use it in a page template...

    I havn't really changed anything else from the default installation. Any suggestions for what is happening?

  2. Innovine
    Member
    Posted 5 years ago #

    Aha!
    This seems to be fixed by using:
    <?php query_posts($query_string."&showposts=10"); ?>

  3. kule
    Member
    Posted 4 years ago #

    Just putting this here too as it's relevant:

    I had this problem when creating a new template. I had used the sidebar before the index/single page which meant I used query_posts to pull out a specific selection of posts before the main loop runs.

    If you do your own custom query_posts make sure you do a wp_reset_query after then the comments will work properly.

    Cheers
    Luke

Topic Closed

This topic has been closed to new replies.

About this Topic