WordPress: Force full comment display on archives or index page

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.

This entry was posted in Geek Notes, WordPress and tagged , , , , . Bookmark the permalink.

2 Responses to WordPress: Force full comment display on archives or index page

  1. Felix Karlsson says:

    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 says:

    Great “trick” ;-) Thanks for share it.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>