Reverse Comments Order of your Theme
By default WordPress displays the comments of a post in an ascending chronological order. That means that the oldest comment comes first. Especially for blog with a great amount of comments it would be interesting to reverse the comments order to display the newest comment on the top.
Of course there are plugins for that. But with a simple change in your comments template you won’t need any plugin. With the PHP array_reverse function we simply turn the comments array generated by WordPress upside town.
Put the following right before the foreach construct in your comments template:
<?php $comments = array_reverse($comments); ?> <?php foreach ($comments as $comment) : ?> <!-- your comment list --> <?php endforeach; /* end for each comment */ ?>
It’s simple as that
If you would like to organize you comments in a reverse order and paginate them, I recommend the Plugin Paginated Comments.
Ähnliche Artikel
Hat Dir der Artikel gefallen?
9 Kommentare zu Reverse Comments Order of your Theme
Sag Deine Meinung!
Free WordPress Themes
Beliebte Artikel
User Kommentare
Alex sagt zu Superfish jQuery Menu IE z-index Bug:
Nice one! I read the klog post before reading this and somehow I had missed...
webdemar sagt zu Frohes Neues!:
@Kristin:
Vielen Dank ;-)...
Kristin sagt zu Frohes Neues!:
Ich wünsche dir auch ein frohes neues Jahr. Ich wünche dir viel Glück bei d...
Alec sagt zu WordPress Theme deFusion 0.9:
Really like your deFusion theme. I've tinkered with it, and thought you mig...
Ahmet Topal sagt zu Sticky Posts in WordPress 2.7:
Ich glaube, dass war Otto42, der dass mit dem Query gesagt hat :?...
3. Dezember 2008
Great tip
Will use it!
2. Oktober 2008
@Jasmin:
Thanks a lot! More to come…
2. Oktober 2008
I just wanted to say I’m using a template you made and I love it. Just love it.
1. Oktober 2008
Works! Not sure for other users though.
Thanks anyway Simon!
1. Oktober 2008
@jc:
Thanks JC! Very nice to hear that
The plugin you’re talking about is called Subcribe to Comments. It is simple, just have to activate it and a ckeckbox will automatically be added to your comment form.
1. Oktober 2008
You made really nice themes, I’m very impressed.
Keep up the good work.
PS. you write well enough for any ordinary person to understand you.
I was wondering how I could inform ppl who have posted comments on a particular post, with future comments, like the one below this post box you’ve made. Not something like yours, but something which performs the same function.
30. September 2008
@pablo:
Nice to see you again
You just have to add the call of the comments template in page.php. Put it right before the endwhile as follows:
Hope this helps…
30. September 2008
hey, since you are posting about comments, how do I enable comments in pages on your “deColor” theme?
cheers!
30. September 2008
Hey thanks man! That’s exactly what I was looking for