Skip to content

August 7, 2011

Order the WordPress Entries by Modified Date

by Andreas Schaefer

Lately I write a continuing blog post about my endeavor to migrate my Snow Leopard Server to Lion. Because I am going to update it multiple times until I am done I want the post to appear on the top of the list after I updated it. It took some time to accomplish it but that is how you can do it:

  1. Open the index.php page of your theme in the Editor of your choice
  2. Look for the line with the function query_posts
  3. Add this text to the query orderly=modified and you might need to add an Ampersand if there are more arguments
  4. This was my original text: <?php query_posts($query_string.’order=DESC’);
  5. Now it looks like this: <?php query_posts($query_string.’orderby=modified&order=DESC’);
  6. Save the file
  7. Reload the page multiple time to make the cache to catch up (my main page remained all white in the first few requests)

Now you should have the post ordered by the modified date and whenever you do update a post it will be listed at the top. Just keep in mind any update no matter how small will do that.

– Andy

Comments are closed.