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天内的文章。
将代码添加到主循环的上面。
本站文章大部分为原创,用于个人学习记录,可能对您有所帮助,仅供参考!

我的微信
微信号已复制
版权声明
本站原创文章转载请注明文章出处及链接,谢谢合作!




