admin管理员组文章数量:1391937
I am using a standard wp_query to load posts. My requirement is to display posts orderby post date and modified date both.
Which means if i added new post that also should show on top and if i modify any post that also should come on top.
How can this work?
$the_query = new WP_Query( array(
'post_type' => $post_type,
'orderby' => 'modified',
'order' => 'DESC',
));
I am using a standard wp_query to load posts. My requirement is to display posts orderby post date and modified date both.
Which means if i added new post that also should show on top and if i modify any post that also should come on top.
How can this work?
$the_query = new WP_Query( array(
'post_type' => $post_type,
'orderby' => 'modified',
'order' => 'DESC',
));
Share
Improve this question
asked Feb 11, 2020 at 21:24
SameerSameer
314 bronze badges
1 Answer
Reset to default 0Just go by the modified date.
WP sets both the published date and the modified date to the same time, when you publish a new post. So, the modified date will always have the most-recent date for every post - whether it's brand-new or an update.
本文标签: wp queryorder by post date and modified date posts both in wpquery
版权声明:本文标题:wp query - order by post date and modified date posts both in wpquery 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744757300a2623540.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论