Recently, I was creating one website in which there were loads of database entries which I needed to integrate into Wordpress Blogging system as it is really flexible.

But the default option of Wordpress is that it always shows all the posts in reverse chronological order but I wanted to change posts order so that the posts on the front page is displayed in an ascending order.

For achieving this, either you can use good plugins that are currently available which allow you to get a greater control of your posts but I found them very complicated and they were meant for more complicated things than just arranging the posts in ascending order.

So, here is a little code that I found which you can place in your /wp-content/themes/THEMENAME/index.php file. You have to place it just before the posts loop code which will basically look something like this:


Just add the following code just before if(have_posts()) and your posts will be arranged in an ascending order.

query_posts($query_string."&order=ASC");

Hope that helps someone who is looking for this code. If you have any other Wordpress queries, then you can make a comment on this post.