Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress:在wp\u查询中添加“今日帖子”的过滤器_Wordpress_Date_Filter - Fatal编程技术网

Wordpress:在wp\u查询中添加“今日帖子”的过滤器

Wordpress:在wp\u查询中添加“今日帖子”的过滤器,wordpress,date,filter,Wordpress,Date,Filter,我在这里运行此查询是为了打印我的wordpress索引页上的帖子: query\u发布$query\u字符串。”&订单=ASC''&post.status=未来,发布' 它给我的帖子要么是发布状态,要么是未来状态。现在我想添加一个过滤器,这个查询只显示今天的帖子。因此,在当前日期已发布的帖子 你能帮我做这个吗?我试了很多次,但都没有成功,也没有改变任何东西,所以我希望你们能提供一些意见 非常感谢 可能是这样的: $today = getdate(); $year=$today["year"];

我在这里运行此查询是为了打印我的wordpress索引页上的帖子:

query\u发布$query\u字符串。”&订单=ASC''&post.status=未来,发布'

它给我的帖子要么是发布状态,要么是未来状态。现在我想添加一个过滤器,这个查询只显示今天的帖子。因此,在当前日期已发布的帖子

你能帮我做这个吗?我试了很多次,但都没有成功,也没有改变任何东西,所以我希望你们能提供一些意见


非常感谢

可能是这样的:

$today = getdate();
$year=$today["year"];
$month=$today["mon"];
$day=$today["mday"];

query_posts( $query_string.'order=ASC' . '&post.status=future,publish'.'&year='.$year.'&monthnum='.$month.'&day='.$day );