edwards block

WordPress: Force full comment display on archives or index page

April 21st, 2009 at 12:37 pm

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.

Written by Edward

April 21st, 2009 at 12:37 pm

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

Subscribe to comments with RSS or TrackBack to 'WordPress: Force full comment display on archives or index page'.

  1. 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

    Felix Karlsson

    23 Jul 09 at 5:52

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

    Enrique

    30 Apr 11 at 10:17

Leave a Reply

Stop censorship