Support » Plugins » Show comments not only on Pages and single Posts

  • Hi

    I’m building a theme where I’d like to display comments for each post on the category archive page. I found out why it wont work with <?php comments_template(); ?> through this forum post:
    http://wordpress.org/support/topic/227877?replies=8

    Now, I understand why the core is coded the way it is, because if a blog has a lot of readers and a lot of comments, you’d need to scroll down a long time if each post had comments under it on for example the first page. Though, for this theme, that will not be a problem (for two reasons, I’m hiding each post and it’s comments with jQuery, plus this client will most likely have few comments on their posts).

    Basically it is this line in wp-includes\comment-template.php that’s the problem:

    if ( ! (is_single() || is_page() || $withcomments) )
    return;

    Which according to that topic should be turned into this:
    if ( ! (is_single() || is_page() || $withcomments) || is_home() )

    That’s what I would like to do, but I’d like to do it in a way so that I don’t have to update that comment-template.php each time I update WP. So, is there a way to write a function or a hack to accomplish what I’m after?

    I’d very much appreciate any help I can get!

    Merry Christmas and many thanks to the core-team for a solid update!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter carl-johan

    (@carl-johan)

    Is this in the wrong forum? If so, please tell me where I should post this topic. Thanks!

    See the little part of the line $withcomments. In your template that you want the comments in add $withcomments=true;.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show comments not only on Pages and single Posts’ is closed to new replies.