php 活动日历 - 获取下一个即将举行的特色活动

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 活动日历 - 获取下一个即将举行的特色活动相关的知识,希望对你有一定的参考价值。

<?php

/**
 * The Events Calendar - Get the next upcoming Featured Event
 *
 * Notes:
 * 1) Ignores all-day events.
 * 2) For the date comparison, this code assumes each event is in
 * the same timezone as your WordPress General Settings timezone.
 *
 * @link https://gist.github.com/cliffordp/1b8c808efa4256ebcef2d8805f069595
 * @link https://theeventscalendar.com/support/forums/topic/pull-in-latest-featured-event/
 * @link https://make.wordpress.org/core/2014/08/29/a-more-powerful-order-by-in-wordpress-4-0/
 * @link https://theeventscalendar.com/knowledgebase/using-tribe_get_events/
 */
$args = array(
	'eventDisplay'   => 'custom',
	'posts_per_page' => 1,
	'meta_query'     => array(
		'relation'   => 'AND',
		'featured'   => array(
			'key'     => Tribe__Events__Featured_Events::FEATURED_EVENT_KEY,
			'compare' => 'EXISTS',
		),
		'start_date' => array(
			'key'     => '_EventStartDate',
			'value'   => current_time( 'mysql' ),
			'compare' => '>=',
			'type'    => 'DATETIME',
		),
	),
	'orderby'        => array(
		'start_date' => 'ASC',
	),

);

$events = tribe_get_events( $args );

以上是关于php 活动日历 - 获取下一个即将举行的特色活动的主要内容,如果未能解决你的问题,请参考以下文章

Facebook 页面日历导出

php 获取活动状态(活动日历)

php 活动日历:获取分配了特定活动类别的所有活动。

php 活动日历:获取分配了特定活动类别的所有活动。

php 活动日历|全天/多日活动

谷歌日历API v3从timeMin之前的全天活动