我相信您会希望使用此功能(从the-events-calendar/src/Tribe/Featured_Events.php:45
):
/**
* Confirms if an event is featured.
* @param int|WP_Post $event
*
* @return bool
*/
public function is_featured( $event = null ) {
$event_id = Tribe__Main::post_id_helper( $event );
if ( ! $event_id ) {
return false;
}
return (bool) get_post_meta( $event_id, self::FEATURED_EVENT_KEY, true );
}
我从未使用过该插件,但您似乎会这样使用它(给它$post对象或post id):
if( Tribe__Events__Featured_Events::is_featured( $post ) ) {
// it\'s featured!
}