• Resolved teknoledge

    (@teknoledge)


    I want to show comments for each post on category.php page. When I include the comments.php in category page I get only form for each post although there are XX comments for each post. How can I achieve this?

    EDIT: comment include is in loop

Viewing 8 replies - 1 through 8 (of 8 total)
  • I want to show comments for each post on category.php page.

    I don’t think you can. That template file is a “multipost archive” and comments – being attached to ONE single post – are displayed only in single post view.

    To include comments/comments template on a multiple post page, you have to (temporarily) fool WordPress into thinking we’re on a single post/Page query. So try:

    <?php
    $wp_query->is_single = true;
    comments_template();
    $wp_query->is_single = false;
    ?>

    Thread Starter teknoledge

    (@teknoledge)

    There must be a way to do it, probably with a custom query ??

    Thread Starter teknoledge

    (@teknoledge)

    @kafkaesqui: Works perfectly! That was quick! Thanks a lot! 🙂

    Thread Starter teknoledge

    (@teknoledge)

    One more thing :), I want to have 2 different comment templates, one for category.php and one for single.php page.

    This is working:
    <?php
    $wp_query->is_single = true;
    comments_template();
    $wp_query->is_single = false;
    ?>

    But this is not working:
    <?php
    $wp_query->is_single = true;
    include (TEMPLATEPATH . ‘/comments-slide.php’);
    $wp_query->is_single = false;
    ?>

    Any tip?

    Try:

    <?php
    $wp_query->is_single = true;
    comments_template('/comments-slide.php');
    $wp_query->is_single = false;
    ?>

    Thread Starter teknoledge

    (@teknoledge)

    Works! Again, thanks a lot!

    hi,

    searching for a similar issue’s solution – I came across you post here – sounds like it’s very close to what I’m trying to achieve…. I’d appreciate it if someone could point me in the right direction to get this resolved on a page, not a category page.

    Site still in working progress (a lot of pages still missing styling and final edits).
    There are specific pages where I want to show recent comments – but only comments of that particular category (and its child categories).
    An example page for this: http://www.phatpiggys.com/wp/bullying/

    The page pulls in posts from its main category, the submenu links for this then show the single post file. The last item in the centre column should be ‘recent comments’.
    (using any of the plugins I found – I was not able to restrict the comments to 1 category alone. the ‘get-recent-comments’ does give this options but I could not figure out how to use more than once to be able to show the different category comments on the different pages….)

    I’ve tried a million and one things, searched the plugins in detail and then found this post – looks so close to a solution but even if I change ‘single’ to ‘page’ in your code – it doesn’t work :'(

    very confused and stuck now :'( I’d appreciate any help!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Comments on category page’ is closed to new replies.