/** * Returns the next event after the current or specified one that shares the * specified tag, else returns boolean false if none can be found. * * @param mixed $tag * @param int $event_id * @return mixed bool|WP_Post */ function next_tagged_event($tag, $event_id = null) { $event_id = Tribe__Events__Main::postIdHelper($event_id); $current_event = get_post($event_id); if (null === $current_event) { return false; } $current_date = tribe_get_start_date($current_event->ID, false, 'Y-m-d H:i:s'); $later = date('Y-m-d H:i:s', strtotime($current_date) + 1); $next_event = event_embed()->obtain(array('tag' => $tag, 'event' => 0 - $current_event->ID, 'start' => $later, 'limit' => 1)); if (empty($next_event)) { return false; } return array_shift($next_event); }
protected function query() { $this->events = $this->check ? event_embed()->obtain($this->params) : array(); }
echo $this->embed($params, $content); } /** * Embedded events request and shortcode handler. * * @param $params * @param $content * @return string */ public function embed($params, $content) { $params = !empty($params) && is_array($params) ? $params : array(); $content = trim($content); $this->finder = new EventRocket_EventLister($params, $content); return $this->finder->output(); } } /** * @return EventRocket_EmbedEventsShortcode */ function event_embed() { static $object = null; if (null === $object) { $object = new EventRocket_EmbedEventsShortcode(); } return $object; } // Call once to ensure the [event-embed] object is created event_embed();