温馨提示:本文最后更新于
2024-09-18 16:04:46
,某些文章具有时效性,若有错误或已失效,请 联系我们 反馈。WordPress获取一定天数内发表的文章代码:
<?php
function filter_where($where = ”) {
$where .= ” AND post_date > ‘” . date(‘Y-m-d’, strtotime(‘-60 days’)) . “‘”;
return $where;
}
add_filter(‘posts_where’, ‘filter_where’);
query_posts($query_string);
?>
默认是60天内的文章。
将代码添加到主循环的上面。
👋 感谢您的观看!
© 版权声明
THE END