By default, most themes are written so that archive or index pages (pages that display multiple posts) show how many comments have been approved, and the reader must click a link to see the actual comments, usually with the result of opening the specific post. This is for good reason, for on a site with a large number of comments on many posts, display of the pages would become unwieldly.

One client, however, wanted all post comments to appear fully visible on his archive/index page. This required some theme tinkering, with a change in which php function was called. The solution, as described by Flisterz, was simple:

I added this to the second line of “archive.php” (not to be confused with “archives.php”), right after the "get_header" line:

<?php $withcomments = 1 ?>

And I added this to the same file, right before the end of the loop:

<?php comments_template(); ?>

Some optional cleaning up was done, to eliminate the old comment code and place tags in the most beneficial spot, but otherwise, that did it.

2 Comments

  1. Felix Karlsson on July 23, 2009 at 05:52

    Hey!
    When I’m submiting a comment I’m getting redirect to single.php, as default. How could I configure this and just update the index.php-page?
    Thankful for a quick response.

    Felix Karlsson



  2. Enrique on April 30, 2011 at 10:17

    Great “trick” 😉 Thanks for share it.