第一次更改您查询的帖子(…)对此:
$args = array(
\'cat\' => 4,
\'posts_per_page\' => 6,
\'orderby\' => \'date\',
\'order\' => \'DESC\',
\'post_status\' =>array(\'future\',\'published\'));
query_posts($args);
然后将此代码添加到主题的函数中。php文件
function my_filter_where( $where = \'\' ) {
global $wp_query;
if (is_array($wp_query->query_vars[\'post_status\'])){
if (in_array(\'future\',$wp_query->query_vars[\'post_status\']){
// posts today into the future
$where .= " AND post_date > \'" . date(\'Y-m-d\', strtotime(\'now\')) . "\'";
}
}
return $where;
}
add_filter( \'posts_where\', \'my_filter_where\' );
现在假设这是唯一一个包含未来帖子的查询,否则需要向查询中添加一个条件参数,并在filter函数中进行检查。