Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1277

    Hi,

    I’m looking for a way to order the 5 posts in the featured category. The best way would be if ordered by the “get_the_modified_time()” function.

    I found it here http://www.wpbeginner.com/wp-tutorials/display-the-last-updated-date-of-your-posts-in-wordpress/, but I don’t know, how to implement it to index.php.

    If this would work, every post, assigned to featured category would automaticaly “jump” to the first (left) place.

    Can you please help me with that?

    #34689

    As far as I know you can achieve what you want by changing the loop order. Open index.php – you’ll find following code there:

    $additional_loop = new WP_Query("cat=".$k_option['mainpage']['feature_cats_final']."&posts_per_page=".$k_option['mainpage']['feature_count']);

    According to this page http://codex.wordpress.org/Template_Tags/query_posts there’s the possibility to order “by modification date” by using orderby=modified

    So replace the code above with:

    $additional_loop = new WP_Query("cat=".$k_option['mainpage']['feature_cats_final']."&orderby=modified&posts_per_page=".$k_option['mainpage']['feature_count']);

    The Dude

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Featured posts – ordered by "last modified" date?’ is closed to new replies.