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?
Featured posts - ordered by "last modified" date?2 posts from 2 voices
Hi,Posted 2 years ago #
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 DudePosted 2 years ago #
You must log in to post.