'WordPress edit post list
I have WordPress kanews theme. I want to list posts by update date. but unfortunately I couldn't. sorts by creation date. how can i solve this problem?
List post by update date
Solution 1:[1]
You would need a custom query and pass orderby
the value of modified
. THis will order them by their modified date and not published date.
$args = [
'post_type' => 'post',
'orderby' => 'modified'
];
$modPosts = new WP_Query( $args );
if ( $modPosts->have_posts() ) : while ( $modPosts->have_posts() ) : $modPosts->the_post();
// Show posts here
endwhile; endif;
// Reset the query
wp_reset_query();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | JayDev95 |