When readers leave comments on most sites running WordPress, the newest comment goes to the bottom of the queue, with the oldest comment at the top. But many site admins prefer to have comments appear in ‘reverse order’, having the newest comments appear first, at the top, and then go in descending order from newest to oldest. There are some plugins out there which will allow you to reverse the order of how comments appear on your blog or website, but why add another plugin to the mix when it is so easy to make comments appear newest first? Here’s how.
In the directory for the WordPress theme you are using, you will find a file called ‘comments.php’.
Make a backup copy of that file (always make a backup before editing source files).
Now, using your favourite editor, edit the comments.php file.
Right around line 14 or so of comments.php, you will see this line:
<?php foreach ($comments as $comment); ?>
Replace that line with this line:
<?php foreach (array_reverse($comments) as $comment); ?>
Then save the file, and almost as if by magic, the comments on your WordPress site will be displayed in “newest at the top” order.
|Get notified of new Internet Patrol articles!