I’m not aware of any such plugin; but you could probably do it quickly enough.
In your theme’s comments.php file, find the line that reads:
<?php foreach ($comments as $comment) : ?>
Immediately above that, please this:
<?php $comments = array_reverse($comments, true); ?>
Note: this is untested. If it works, please let us know!
Thanx very much skippy. It works fine!!! The newest/latest comment shows up first. Only thing is…is it possible to reverse the comment numbers too, because they haven’t reversed.
I have a line of code in the comments-template like this:
<h3 id=”comments”><?php comments_number(‘No Responses’, ‘One Response’, ‘% Responses’ );?> to “<?php the_title(); ?>”</h3>
should i add such a line as you said here too ?
No. You only need the array_reverse() function immediately before the foreach ... loop.
Try changing true to false on the array_reverse() line to swap the modify the comment numbers.
I changed “true” to “false” . The comments are still reversed but the numbers are still the same…. Nothing happened ..
Oh; right. The problem is that the comment list uses an HTML ordered list to construct the numbers:
<ol class="commentlist">
<?php foreach ($comments as $comment) : ?>
<li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
If the comment numbers are really important to you, you could suppress the digits for the ordered list; then do something like this:
$count = count($comments);
<ol class="commentlist">
<?php foreach ($comments as $comment) : ?>
<li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
<?php echo $count; ?>
// the rest of the comment loop here...
$count--;
<?php endforeach; /* end for each comment */ ?>
</ol>
Hmmz, that second code didn’t quite work, “$count–;” showed up between every post. I checked and double-checked if i made an error/mistake.. but numbers aren’t that important to me… so i stick to your first line of code, ….it’s not exactly what i wanted but close enough, thanx very much for your help effort and your patience with me π
Sorry, that line should have read:
<?php $count--; ?>
I tried this and it works but I have to change
$count = count($comments);
to
<?php $count = count($comments); ?>
or put $count = count($comments);
at the top inside the <?php and ?>
for it to work.. thanks π