Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/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 查询职位显示最近的职位,不包括所有未来的职位_Wordpress_Posts - Fatal编程技术网

Wordpress 查询职位显示最近的职位,不包括所有未来的职位

Wordpress 查询职位显示最近的职位,不包括所有未来的职位,wordpress,posts,Wordpress,Posts,我想在wordpress query_帖子中区分最近发生的事件和即将发生的事件,非常感谢您的帮助 我正在尝试: query_posts($query_string.&post_type=great_events&monthnum='.date('n',current_time('timestamp')) 我不知道如何排除未来的帖子/事件 提前感谢, Tony的query\u posts()参数数组接受WP\u query允许的任何参数 使用按钮选择所需的post stati 使用来选择一个月,虽

我想在wordpress query_帖子中区分最近发生的事件和即将发生的事件,非常感谢您的帮助

我正在尝试: query_posts($query_string.&post_type=great_events&monthnum='.date('n',current_time('timestamp'))

我不知道如何排除未来的帖子/事件

提前感谢,

Tony

query\u posts()
参数数组接受WP\u query允许的任何参数

使用按钮选择所需的post stati


使用来选择一个月,虽然我想过去的几个月不太可能有未来的帖子。

如果您使用的是事件日历(),那么它们的文档非常好

因此,对于您的情况,您不会使用正常的wp查询,而是使用自己的查询,如下所示:

$events = tribe_get_events( array(
    'posts_per_page' => 5, //how many you want per page
    'end_date' => date( 'Y-m-d H:i:s' ) //anything up to now
) );

你可以在这里阅读更多相关信息

谢谢wedi,我刚刚发现“事件日历”插件使用了自己的开始日期和结束日期,并且它不是wordpress未来的常规帖子。希望我能帮上忙。谢谢wedi,通过这一点,我成功地获得了正确的类别:查询帖子($query\u string.&post\u type=trive\u events现在剩下的是如何显示带有“tribe\u event\u start\u date”的所有事件小于今天/当前时间…?您可以根据链接的文档使用
日期查询的
参数,或者上面同样链接的
后状态
参数。谢谢wedi,我刚刚发现“事件日历”插件使用它自己的开始日期和结束日期,它不是一个普通的wordpress未来帖子。所以我真正需要的是根据帖子类型显示最近的帖子,并排除所有未来带有“开始日期”的帖子…感谢Ovidiua2003和Wedi的贡献和帮助,非常感谢,没有你们,网络将是一个无聊的地方:)这是我在Post Grid中使用的最后一个自定义查询:
Post\u type=tribe\u events&Post\u status=publish&posts\u per\u page=3&end\u date=