DUX 主题小工具中“聚合文章”默认调取的是所有时间的文章,根据个人需要修改了下只调取最近一段时间(一年内的)文章。此方法兼容版本 dux v6.1
文件路径:/wp-content/themes/dux/widgets/widget-posts.php
修改前源代码:
function dtheme_posts_list($orderby,$limit,$cat,$img,$comn) { $args = array( 'cat' => $cat, 'order' => 'DESC', 'showposts' => $limit, 'ignore_sticky_posts' => 1 );
修改后源代码:
function dtheme_posts_list($orderby,$limit,$cat,$img,$comn) { $args = array( 'cat' => $cat, 'order' => 'DESC', 'showposts' => $limit, 'ignore_sticky_posts' => 1, 'date_query' => array(array('column' => 'post_date_gmt', 'after' => '1 year ago',)) );
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。