Reverse the order of comments without editing theme

I was looking for a way to reverse the order in which comments are displayed in a WordPress blog for one of my projects. After a bit of Googling I found a Plugin called Reverse Order Comments. A quick look into the source code revealed that it was rewriting the comment template and you need to edit the theme to make it work. My instinct told me that it would be easy to accomplish it using the array_reverse comment in PHP.

I followed my instinct and tried to see whether it is possible to do it in a simple way. In the end I accomplished it with less than 10 lines of code and more importantly without the need to edit the theme files. Another instance of the KISS principle in action 😉

I packed it as a Plugin so that you can just drop it into your plugins directory, activate it and then forget about it. It is called Simple Reverse Comments and you can download it from my Plugins page.

Related posts

Tags: , ,

4 Comments so far

Follow up comments through RSS Feed | Post a comment

  • Tim says:

    On the first look, your plugin and mine (Reverse Order Comments) seem to do the same.
    But there is a little difference. Yours reverses all comments on all blog posts. Mine doesn’t, as it was not written do do this.
    And – here I am assuming, as I wrote the plugin more than a year ago – I could not make mine as short as yours, as I am not in the wordpress comment loop and can’t use the comments_array filter, as the filter would affect all posts.

    Nevertheless, if somebody wants to reverse the comments for all his posts, your plugin is the most elegant solution.

  • Sudar says:

    Hello Tim,

    Now I understand the difference between the two Plugins. Earlier I was under the impression that you were reversing the order of comments for all blog posts.

    Since you blog was not in English, I was not able to read the full description. Anyways thanks for letting me know the difference.

  • Ruchi says:

    Quite a good plugin, well thought of 🙂
    Will give it a try thank.

3 Trackbacks/Pingbacks so far

Leave a Reply

Your email address will not be published. Required fields are marked *