Support » Fixing WordPress » Display comments from newest to oldest based on timestamp

  • Resolved curtisservices

    (@curtisservices)


    Hello,
    I’m trying to get the comments to display from newest to oldest based on the timestamp. I didn’t see an option for this, so I assume it’s something I need to tweak in the php code. Any help would be great!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    Add this to your theme’s functions.php file:

    function reverse_comments($comments,$id) {
    $comments = array_reverse($comments);
    return $comments;
    }
    add_filter('comments_array','reverse_comments',10,2);
    curtisservices

    (@curtisservices)

    It works! You’re AWESOME! Thanks for the fast response!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display comments from newest to oldest based on timestamp’ is closed to new replies.