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

Here is the simple solution. Simply use this:

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

before where the Loop checks for posts:

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

It basically adds a condition to the Loop. Enjoy!

Aucun commentaire pour cet article. Soyez le premier à réagir !

Laisser un commentaire