Support » Themes and Templates » Reverse comments order?

  • I’m trying to reverse the order of the comments so that the most recent comments are on top. I’ve tried choosing that in the Discussion Settings on my Dashboard. I’ve also tried a plugin called Reverse Order Comments. Neither have worked for me. Any ideas?

    Here’s my site for reference:

Viewing 9 replies - 1 through 9 (of 9 total)
  • esmi


    Forum Moderator

    What options did you choose in Settings/Discussion?

    “Comments should be displayed with the newer comments at the top of each page.”



    Forum Moderator

    And the previous line in Discussion settings? Which page is being displayed by default?

    I’ve tried both “first” and “last”.



    Forum Moderator

    Have a look in your theme’s comments.php file for the wp_list_comments() tag. If it’s not in there. it would explain why your theme isn’t picking up the Discussion settings.

    Here is what it says. Any suggestions of what I should change or add?

    <!– start editing here –>

    <?php if ($comments) : ?>

    <div class=”commentlist”>

    <?php foreach ($comments as $comment) : ?>

    <div <?php echo $oddcomment; ?>id=”comment-<?php comment_ID() ?>”>
    <table width=”100%” border=”0″ cellpadding=”2″ cellspacing=”2″>
    <td width=”30%” valign=”top”><div align=”center”><b><?php comment_author_link() ?></b>

    <?php echo get_avatar( $comment, 32 ); ?></div></td>
    <td width=”70%” valign=”top”><span style=”text-transform: uppercase;”><small><?php comment_date(‘F jS, Y’) ?></small> <small class=”commentmetadata”><?php comment_time() ?></small></span> <!–<small><?php edit_comment_link(‘edit comment’,’  ‘,”); ?></small>–>

    <?php if ($comment->comment_approved == ‘0’) : ?>
    <?php endif; ?>

    <?php comment_text() ?></td>

    /* changes every other comment to a different class */
    $oddcomment = ( empty( $oddcomment ) ) ? ‘class=”alt” ‘ : ”;



    Forum Moderator

    You could replace everything from <div class="commentlist"> to </div> with <?php wp_list_comments(); ?> but that would almost certainly wreck your current comment display and require a major CSS re-edit.

    <?php foreach ($comments as $comment) : ?>


    <?php foreach (array_reverse($comments) as $comment) : ?>



    Hey lawyer01 your suggestion above about adding the array_reverse() function did the trick of changing the order that comments are displayed. Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Reverse comments order?’ is closed to new replies.