Displaying the WordPress ‘Comments Template’ outside the ‘loop’

So I’m building a wordpress theme, and I need the comments to come down in a dropdown from each post on the homepage. Bullshit you have to click on the post to see the comments! It worked really well, when there was only one post. It worked with only one post because I was displaying the comments template OUTSIDE the loop. But with multiple posts, the comments template must be inside the loop, however, when you put the comments template reference in the loop it doesn’t fire, meaning the template isn’t displayed!

How can I get the comments template to display in the loop so it will appear on each post on the homepage and I can set it up as a dropdown menu?

Read More

Here’s the site I’m implementing it on: http://thenozzle.net/
You can see it, or rather, not see it happening if you click on ‘Show # Comments Here’. Simple php stuff, but I can’t figure out why when the comments template reference is palce din th eloop, is doesn’t fire.

Here’s the reference and code:

<div id="dropdowncomments">
        <?php comments_template(); ?>
</div>

Like I said, dropdown comments is hidden, and when you click on it, it appears, but comments template isn’t loading inside loop.php so, no good.

Any help?

Related posts

Leave a Reply

1 comment

  1. It is easy (I hope I understood you correctly). Just after the the_content() call, setup the $withcomments variable (global) and call comments_template():

    the_content();
    global $withcomments;
    $withcomments = 1;
    comments_template( 'comments.php', true );