How to sort WordPress posts by modified date instead of published date?

Here is the simple solution. Simply use this:

1<?php query_posts($query_string . '&orderby=modified&order=desc'); ?>

before where the Loop checks for posts:

1<?php /* If there are any posts: */
2if (have_posts()) ...
3?>

It basically adds a condition to the Loop. Enjoy!

Be the first to comment this post!

Leave a comment