function tribe_rss_feed_add_eventdate() { ?> <ev:tribe_event_meta xmlns:ev="Event"> <?php if (tribe_get_start_date() !== tribe_get_end_date()) { ?> <ev:startdate><?php echo tribe_get_start_date(); ?> </ev:startdate> <ev:enddate><?php echo tribe_get_end_date(); ?> </ev:enddate> <?php } else { ?> <ev:startdate><?php echo tribe_get_start_date(); ?> </ev:startdate> <?php } ?> </ev:tribe_event_meta> <?php }
/** * The countdown widget requires the date of the event to be passed in * as an argument. */ protected function set_date() { if (!isset($this->arguments['event_ID'])) { return; } $this->arguments['event_date'] = tribe_get_start_date($this->arguments['event_ID'], false, Tribe__Events__Date_Utils::DBDATEFORMAT); }
/** * Get the event date * * @param int $meta_id * @return string */ public static function event_date($meta_id) { $time_format = get_option('time_format', TribeDateUtils::TIMEFORMAT); $start_time = tribe_get_start_date(null, false, $time_format); $end_time = tribe_get_end_date(null, false, $time_format); if (tribe_event_is_all_day()) { if (tribe_event_is_multiday()) { $html = Tribe_Meta_Factory::template(__('Start:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr updated published dtstart" title="%s">%s</abbr>', tribe_get_start_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_start_date()), $meta_id); $html .= Tribe_Meta_Factory::template(__('End:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr dtend" title="%s">%s</abbr>', tribe_get_end_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_end_date()), $meta_id); } else { // If all day event, show only start date $html = Tribe_Meta_Factory::template(__('Date:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr updated published dtstart" title="%s">%s</abbr>', tribe_get_start_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_start_date()), $meta_id); } } elseif (tribe_event_is_multiday()) { // If multiday, show start date+time and end date+time $html = Tribe_Meta_Factory::template(__('Start:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr updated published dtstart" title="%s">%s</abbr>', tribe_get_start_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_start_date()), $meta_id); $html .= Tribe_Meta_Factory::template(__('End:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr dtend" title="%s">%s</abbr>', tribe_get_end_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_end_date()), $meta_id); } else { // show start date $html = Tribe_Meta_Factory::template(__('Date:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr updated published dtstart" title="%s">%s</abbr>', tribe_get_start_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_start_date(null, false)), $meta_id); if ($start_time == $end_time) { // if start and end time are the same, just show the start time $html .= Tribe_Meta_Factory::template(__('Time:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr dtend" title="%s">%s</abbr>', tribe_get_end_date(null, false, TribeDateUtils::DBDATEFORMAT), $start_time), $meta_id); } else { // show start and end time $html .= Tribe_Meta_Factory::template(__('Time:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr dtend" title="%s">%s</abbr>', tribe_get_end_date(null, false, TribeDateUtils::DBDATEFORMAT), $start_time . ' - ' . $end_time), $meta_id); } } return apply_filters('tribe_event_meta_event_date', $html); }
/** * Compile the schema.org event data into an array */ private function build_data() { global $post; $id = $post->ID; $events_data = array(); // Index by ID: this will allow filter code to identify the actual event being referred to // without injecting an additional property $events_data[$id] = new stdClass(); $events_data[$id]->{'@context'} = 'http://schema.org'; $events_data[$id]->{'@type'} = 'Event'; $events_data[$id]->name = get_the_title(); if (has_post_thumbnail()) { $events_data[$id]->image = wp_get_attachment_url(get_post_thumbnail_id($post->ID)); } $events_data[$id]->url = get_the_permalink($post->ID); $events_data[$id]->startDate = get_gmt_from_date(tribe_get_start_date($post, true, TribeDateUtils::DBDATETIMEFORMAT), 'c'); $events_data[$id]->endDate = get_gmt_from_date(tribe_get_end_date($post, true, TribeDateUtils::DBDATETIMEFORMAT), 'c'); if (tribe_has_venue($id)) { $events_data[$id]->location = new stdClass(); $events_data[$id]->location->{'@type'} = 'Place'; $events_data[$id]->location->name = tribe_get_venue($post->ID); $events_data[$id]->location->address = strip_tags(str_replace("\n", '', tribe_get_full_address($post->ID))); } /** * Allows the event data to be modifed by themes and other plugins. * * @param array $events_data objects representing the Google Markup for each event. */ $events_data = apply_filters('tribe_google_event_data', $events_data); // Strip the post ID indexing before returning $events_data = array_values($events_data); return $events_data; }
/** * Course Start Date & Time [start_date_time] * @return MM/DD/YYYY @ HH:MM */ function swsctp_course_date_time() { if (tribe_get_start_date()) { return tribe_get_start_date(); } else { return "[class_start_date_time]"; } }
/** * Returns the event's timezone abbreviation if it can be determined, or else * falls back on the full timezone string/offset text (again, if known - if it * is not it will assume the global WP timezone setting). * * @param int|null $event_id * * @return string */ public static function get_event_timezone_abbr($event_id = null) { $abbr = get_post_meta($event_id, '_EventTimezoneAbbr', true); if (empty($abbr)) { $timezone_string = self::get_event_timezone_string($event_id); $date = tribe_get_start_date($event_id, true, Tribe__Date_Utils::DBDATETIMEFORMAT); $abbr = self::abbr($date, $timezone_string); } return empty($abbr) ? $timezone_string : $abbr; }
/** * Organize and reorder the events posts according to time slot * * @return void * @since 1.0 **/ public function setup_view() { global $wp_query; if ($wp_query->have_posts()) { foreach ($wp_query->posts as &$post) { $post->timeslot = tribe_event_is_all_day($post->ID) ? __('All Day', 'tribe-events-calendar-pro') : ($post->timeslot = tribe_get_start_date($post, false, 'l, F jS Y g:i A')); } $wp_query->rewind_posts(); } }
function front_end($args, $instance) { extract($args); $limit = intval($instance['load']); $title = $instance['title']; $events = tribe_get_events(array('eventDisplay' => 'upcoming', 'posts_per_page' => $event_count)); if (!empty($events)) { echo $title ? $before_title . $title . $after_title : ''; foreach ($events as $event) { $start_date = strtotime(tribe_get_start_date($event->ID)); $start_date_day = date('Y-m-d', $start_date); $end_date = strtotime(tribe_get_end_date($event->ID)); $end_date_day = date('Y-m-d', $end_date); $all_day = tribe_event_is_all_day($event->ID); $time_format = get_option('time_format'); if ($all_day) { $date_format = date('F jS', $start_date) . '<span>•</span> <em>' . __('All day', 'espresso') . '</em>'; } else { if ($end_date_day) { if ($start_date_day == $end_date_day) { $date_format = date('F jS', $start_date) . '<span>•</span> <em>' . date($time_format, $start_date) . ' – ' . date($time_format, $end_date) . '</em>'; } else { $date_format = date('F jS', $start_date) . ' <em>@ ' . date($time_format, $start_date) . '<br />' . __('to', 'espresso') . '</em> ' . date('F jS', $end_date) . ' <em>@' . date($time_format, $end_date) . '</em>'; } } } ?> <article class="upcoming-event-block clearfix"> <h3><a href="<?php echo get_permalink($event->ID); ?> "><?php echo apply_filters('the_title', $event->post_title); ?> </a></h3> <small><?php echo $date_format; ?> </small> <p><?php echo $event->post_excerpt ? $event->post_excerpt : espressoTruncate($event->post_content, 155) . ' ...'; ?> </p> <a class="es-button" href="<?php echo get_permalink($event->ID); ?> "><?php _e('Event Information', 'espresso'); ?> </a> </article><?php } } wp_reset_query(); }
protected function maintain_gap(array &$meta, $original) { // Original event start/end times and difference between them $start = tribe_get_start_date($original->ID, false, Tribe__Events__Date_Utils::DBDATETIMEFORMAT); $end = tribe_get_end_date($original->ID, false, Tribe__Events__Date_Utils::DBDATETIMEFORMAT); $diff = strtotime($end) - strtotime($start); // Adjust new event end time to maintain the same difference $start = strtotime($meta['_EventStartDate']); $end = $start + $diff; $meta['_EventEndDate'] = date(Tribe__Events__Date_Utils::DBDATETIMEFORMAT, $end); }
/** * Get the event date * * @param int $meta_id * @return string */ function event_date($meta_id) { if (tribe_get_start_date() !== tribe_get_end_date()) { // Start & end date $html = Tribe_Meta_Factory::template(__('Start:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr updated published dtstart" title="%s">%s</abbr>', tribe_get_start_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_start_date()), $meta_id); $html .= Tribe_Meta_Factory::template(__('End:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr dtend" title="%s">%s</abbr>', tribe_get_end_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_end_date()), $meta_id); } else { // If all day event, show only start date $html = Tribe_Meta_Factory::template(__('Date:', 'tribe-events-calendar'), sprintf('<abbr class="tribe-events-abbr updated published dtstart" title="%s">%s</abbr>', tribe_get_start_date(null, false, TribeDateUtils::DBDATEFORMAT), tribe_get_start_date()), $meta_id); } return apply_filters('tribe_event_meta_event_date', $html); }
/** * 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); }
public function get_output($event_ID, $complete, $show_seconds, $event_date = null) { $ret = $complete; ob_start(); include Tribe__Events__Templates::getTemplateHierarchy('pro/widgets/countdown-widget'); $hourformat = ob_get_clean(); // Get the event start date. $startdate = tribe_is_recurring_event($event_ID) ? $event_date . ' ' . tribe_get_start_date($event_ID, false, Tribe__Events__Date_Utils::DBTIMEFORMAT) : tribe_get_start_date($event_ID, false, Tribe__Events__Date_Utils::DBDATETIMEFORMAT); // Get the number of seconds remaining until the date in question. $seconds = strtotime($startdate) - current_time('timestamp'); if ($seconds > 0) { $ret = $this->generate_countdown_output($seconds, $complete, $hourformat, $event_ID, $event_date); } return $ret; }
/** * Compile the schema.org event data into an array */ protected function build_data() { global $post; $id = $post->ID; $event_data = parent::build_data(); $event_data[$id]->{'@type'} = 'Event'; $event_data[$id]->startDate = get_gmt_from_date(tribe_get_start_date($post, true, Tribe__Events__Date_Utils::DBDATETIMEFORMAT), 'c'); $event_data[$id]->endDate = get_gmt_from_date(tribe_get_end_date($post, true, Tribe__Events__Date_Utils::DBDATETIMEFORMAT), 'c'); if (tribe_has_venue($id)) { $event_data[$id]->location = new stdClass(); $event_data[$id]->location->{'@type'} = 'Place'; $event_data[$id]->location->name = tribe_get_venue($post->ID); $event_data[$id]->location->address = strip_tags(str_replace("\n", '', tribe_get_full_address($post->ID))); } return $event_data; }
/** * Injects event meta data into the Attendees report * * @param int $event_id */ public function event_details_top($event_id) { $post_type = get_post_type($event_id); if (Tribe__Events__Main::POSTTYPE === $post_type) { echo ' <li> <strong>' . esc_html__('Start Date:', 'the-events-calendar') . '</strong> ' . tribe_get_start_date($event_id, false, tribe_get_date_format(true)) . ' </li> '; } if (tribe_has_venue($event_id)) { $venue_id = tribe_get_venue_id($event_id); echo ' <li class="venue-name"> <strong>' . tribe_get_venue_label_singular() . ': </strong> <a href="' . get_edit_post_link($venue_id) . '" title="' . esc_html__('Edit Venue', 'the-events-calendar') . '">' . tribe_get_venue($event_id) . '</a> </li> '; } }
/** * Intelligently updates our record of the earliest start date/latest event date in * the system. If the existing earliest/latest values have not been superseded by the new post's * start/end date then no update takes place. * * This is deliberately hooked into save_post, rather than save_post_tribe_events, to avoid issues * where the removal/restoration of hooks within addEventMeta() etc might stop this method from * actually being called (relates to a core WP bug). * * @param int $event_id */ public function update_known_range($event_id) { $is_earliest_date_marker = in_array($event_id, tribe_get_option('earliest_date_markers', array())); $is_latest_date_marker = in_array($event_id, tribe_get_option('latest_date_markers', array())); if ($is_earliest_date_marker || $is_latest_date_marker) { $this->rebuild_known_range(); return; } $current_min = tribe_events_earliest_date(); $current_max = tribe_events_latest_date(); $event_start = tribe_get_start_date($event_id, false, Tribe__Date_Utils::DBDATETIMEFORMAT); $event_end = tribe_get_end_date($event_id, false, Tribe__Date_Utils::DBDATETIMEFORMAT); if ($current_min > $event_start) { $this->rebuild_known_range(); tribe_update_option('earliest_date', $event_start); } if ($current_max < $event_end) { $this->rebuild_known_range(); tribe_update_option('latest_date', $event_end); } }
/** * Fetches the JSON-LD data for this type of object * * @param int|WP_Post|null $post The post/event * @param array $args * @return array */ public function get_data($posts = null, $args = array()) { $posts = $posts instanceof WP_Post ? array($posts) : (array) $posts; $return = array(); foreach ($posts as $i => $post) { $data = parent::get_data($post, $args); // If we have an Empty data we just skip if (empty($data)) { continue; } // Fetch first key $post_id = key($data); // Fetch first Value $data = reset($data); $event_tz_string = get_post_meta($post_id, '_EventTimezone', true); $tz_mode = tribe_get_option('tribe_events_timezone_mode', 'event'); $tz_string = $event_tz_string && $tz_mode === 'event' ? $event_tz_string : Tribe__Events__Timezones::wp_timezone_string(); $data->startDate = Tribe__Events__Timezones::to_utc(tribe_get_start_date($post_id, true, Tribe__Date_Utils::DBDATETIMEFORMAT), $tz_string, 'c'); $data->endDate = Tribe__Events__Timezones::to_utc(tribe_get_end_date($post_id, true, Tribe__Date_Utils::DBDATETIMEFORMAT), $tz_string, 'c'); if (tribe_has_venue($post_id)) { $venue_id = tribe_get_venue_id($post_id); $venue_data = Tribe__Events__JSON_LD__Venue::instance()->get_data($venue_id); $data->location = reset($venue_data); } if (tribe_has_organizer($post_id)) { $organizer_id = tribe_get_organizer_id($post_id); $organizer_data = Tribe__Events__JSON_LD__Organizer::instance()->get_data($organizer_id); $data->organizer = reset($organizer_data); } $price = tribe_get_cost($post_id); $price = $this->normalize_price($price); if ('' !== $price) { // Manually Include the Price for non Event Tickets $data->offers = (object) array('@type' => 'Offer', 'price' => $price, 'url' => $data->url); } $return[$post_id] = $data; } return $return; }
function add_date_to_events_calendar($html) { $html = ''; global $post, $wp_query; $event_year = tribe_get_start_date($post, false, 'Y'); $event_month = tribe_get_start_date($post, false, 'm'); $event_day = tribe_get_start_date($post, false, 'j'); if ($wp_query->current_post > 0) { $prev_post = $wp_query->posts[$wp_query->current_post - 1]; $prev_event_year = tribe_get_start_date($prev_post, false, 'Y'); $prev_event_month = tribe_get_start_date($prev_post, false, 'm'); $prev_event_day = tribe_get_start_date($prev_post, false, 'j'); } /* * If the event month changed since the last event in the loop, * or is the same month but the year changed. * */ if ($wp_query->current_post === 0 || ($prev_event_month != $event_month || $prev_event_month == $event_month && $prev_event_year != $event_year)) { $html .= sprintf("<div class='tribe-events-list-separator-month'><span>%s</span></div>", tribe_get_start_date($post, false, 'F Y')); } /* * If this event year is different to the year of the previous event in the loop, * and it’s not it’s not the first event in the loop (we don’t want to start the loop with a year separator) */ if ($wp_query->current_post > 0 && $prev_event_year != $event_year) { $html .= sprintf("<span class='tribe-events-list-separator-year'>%s</span>", $event_year); } /* * If the event day changed since the last event in the loop, * or is the same day but the month changed. * */ if ($wp_query->current_post === 0 || ($prev_event_day != $event_day || $prev_event_day == $event_day && $prev_event_month != $event_month)) { $html .= sprintf("<div class='tribe-events-list-separator-month'><span>%s</span></div>", tribe_get_start_date($post, false, 'F j (l)')); } return $html; }
/** * Alters the provided formatted time to include all recurrence times for the day * * @since 4.0.3 * * @param string $formatted_time Formatted time range for the given event * @param int $event_id Event ID * * @return string */ public function maybe_render_multiple_formatted_times($formatted_time, $event_id) { if (!tribe_is_recurring_event($event_id)) { return $formatted_time; } $date = tribe_get_start_date($event_id, false, Tribe__Date_Utils::DBDATEFORMAT); $time_format = get_option('time_format', Tribe__Date_Utils::TIMEFORMAT); $time_range_separator = tribe_get_option('timeRangeSeparator', ' - '); $events = $this->get_recurring_events_for_date($event_id, $date); $formatted_time = null; foreach ($events as $child) { $start_time = tribe_get_start_date($child->ID, false, $time_format); $end_time = tribe_get_end_date($child->ID, false, $time_format); $formatted_time .= '<div class="tribe-recurring-event-time">'; if ($start_time === $end_time) { $formatted_time .= esc_html($start_time); } else { $formatted_time .= esc_html($start_time . $time_range_separator . $end_time); } $formatted_time .= '</div>'; } return $formatted_time; }
/** * Organize and reorder the events posts according to time slot * * @return void **/ public function setup_view() { global $wp_query; $time_format = apply_filters('tribe_events_day_timeslot_format', get_option('time_format', TribeDateUtils::TIMEFORMAT)); if ($wp_query->have_posts()) { $unsorted_posts = $wp_query->posts; foreach ($unsorted_posts as &$post) { if (tribe_event_is_all_day($post->ID)) { $post->timeslot = __('All Day', 'tribe-events-calendar'); } else { if (strtotime(tribe_get_start_date($post->ID, true, TribeDateUtils::DBDATETIMEFORMAT)) < strtotime($wp_query->get('start_date'))) { $post->timeslot = __('Ongoing', 'tribe-events-calendar'); } else { $post->timeslot = tribe_get_start_date($post, false, $time_format); } } } unset($post); // Make sure All Day events come first $all_day = array(); $ongoing = array(); $hourly = array(); foreach ($unsorted_posts as $i => $post) { if ($post->timeslot == __('All Day', 'tribe-events-calendar')) { $all_day[$i] = $post; } else { if ($post->timeslot == __('Ongoing', 'tribe-events-calendar')) { $ongoing[$i] = $post; } else { $hourly[$i] = $post; } } } $wp_query->posts = array_values($all_day + $ongoing + $hourly); $wp_query->rewind_posts(); } }
/** * Organize and reorder the events posts according to time slot * * @return void * @since 3.0 **/ public function setup_view() { global $wp_query; $time_format = apply_filters('tribe_events_pro_day_timeslot_format', 'ga '); if ($wp_query->have_posts()) { $unsorted_posts = $wp_query->posts; foreach ($unsorted_posts as &$post) { $post->timeslot = tribe_event_is_all_day($post->ID) ? __('All Day', 'tribe-events-calendar-pro') : ($post->timeslot = tribe_get_start_date($post, false, $time_format)); } unset($post); // Make sure All Day events come first $all_day = array(); $hourly = array(); foreach ($unsorted_posts as $i => $post) { if ($post->timeslot == __('All Day', 'tribe-events-calendar-pro')) { $all_day[$i] = $post; } else { $hourly[$i] = $post; } } $wp_query->posts = array_values($all_day + $hourly); $wp_query->rewind_posts(); } }
public function add_duplicate_action($actions, $post) { // Not a post? Bail (we aren't using a typehint since some plugins may pass in something a stdClass object etc) if (!is_a($post, 'WP_Post')) { return $actions; } // Not an event? Don't add the link if (Tribe__Events__Main::POSTTYPE !== $post->post_type) { return $actions; } // Recurring event? Don't add the link either! if (function_exists('tribe_is_recurring_event') && tribe_is_recurring_event($post->ID)) { return $actions; } // Form the link $url = $this->duplication_link_url($post->ID); $text = __('Duplicate', 'event-rocket'); $date = tribe_get_start_date($post->ID, false, 'Y-m-d\\TH:i:s'); $title = $this->get_duplicate_post_title($post); $link = '<a href="' . $url . '" class="eventrocket_duplicate" ' . 'data-date="' . $date . '" ' . 'data-title="' . $title . '" ' . '>' . $text . '</a>'; // Add to the list of actions $actions['duplicate'] = $link; return $actions; }
?> </a> <a href="<?php the_permalink(); ?> "> <div class="row front-date-row week"> <div class="col-md-12 front-date"> <div class="front-day"> <?php echo tribe_get_start_date(null, false, 'd'); ?> </div> <div class="front-month"> <?php echo tribe_get_start_date(null, false, 'M'); ?> </div> </div> <div class="col-md-12 front-event-title "> <?php echo substr(the_title($before = "", $after = "", FALSE), 0, 15); ?> <br> <span class="front-location"> <?php echo tribe_get_full_address(); ?> </span> </div> </div>
<?php /** * Single Event Meta (Details) Template * * Override this template in your own theme by creating a file at: * [your-theme]/tribe-events/modules/meta/details.php * * @package TribeEventsCalendar */ $time_format = get_option('time_format', Tribe__Events__Date_Utils::TIMEFORMAT); $time_range_separator = tribe_get_option('timeRangeSeparator', ' - '); $start_datetime = tribe_get_start_date(); $start_date = tribe_get_start_date(null, false); $start_time = tribe_get_start_date(null, false, $time_format); $start_ts = tribe_get_start_date(null, false, Tribe__Events__Date_Utils::DBDATEFORMAT); $end_datetime = tribe_get_end_date(); $end_date = tribe_get_end_date(null, false); $end_time = tribe_get_end_date(null, false, $time_format); $end_ts = tribe_get_end_date(null, false, Tribe__Events__Date_Utils::DBDATEFORMAT); $instructor = get_post_meta(get_the_ID(), 'Instructor', true); $cost = tribe_get_formatted_cost(); $website = tribe_get_event_website_link(); ?> <div class="tribe-events-meta-group tribe-events-meta-group-details"> <h3 class="tribe-events-single-section-title"> <?php esc_html_e('Details', 'the-events-calendar'); ?> </h3> <dl>
</a><br /> <?php if (tribe_get_start_date() !== tribe_get_end_date()) { ?> <?php echo tribe_get_start_date(); ?> - <?php echo tribe_get_end_date(); ?> <?php } else { ?> <?php echo tribe_get_start_date(); ?> <?php } ?> <?php the_content(); ?> <?php } } wp_reset_postdata(); ?>
/** * Breaks the possible collection of events down by grid date * * @param string $date Y-m-d formatted date to retrieve events for * * @return array */ private function get_event_ids_by_day($date) { if (!$this->event_ids_by_day) { $this->event_ids_by_day = array(); // Let's loop over all of the events in the month and assign them to days foreach ($this->events_in_month as $event) { // if we're querying by category and the event doesn't have it, skip the event if (!empty($this->queried_event_cats)) { if (!has_term($this->queried_event_cats, Tribe__Events__Main::TAXONOMY, $event)) { continue; } } $event_start = strtotime(tribe_get_start_date($event->ID, true, Tribe__Date_Utils::DBDATETIMEFORMAT)); $event_end = strtotime(tribe_get_end_date($event->ID, true, Tribe__Date_Utils::DBDATETIMEFORMAT)); $start = date('Y-m-d', $event_start); $end = date('Y-m-d', $event_end); $beginning_of_start = $this->get_cutoff_details($start, 'beginning'); $beginning_of_start_timestamp = $this->get_cutoff_details($start, 'beginning_timestamp'); $end_of_start = $this->get_cutoff_details($start, 'end'); $end_of_start_timestamp = $this->get_cutoff_details($start, 'end_timestamp'); $beginning_of_end = $this->get_cutoff_details($end, 'beginning'); $beginning_of_end_timestamp = $this->get_cutoff_details($end, 'beginning_timestamp'); // if the start of the event is earlier than the beginning of the day, consider the event // as starting on the day before // // Example 1: // Assuming a cut-off of 6:00am and an event start date/time of August 2nd @ 5:00am. The // "start" DATE would be August 2nd and the beginning of the "start" DATE would be August // 2nd @ 6:00am. Therefore, the event start DATE shoud be altered to be a day earlier // (August 1st) (Note: the following if statement conditional would be true) if ($event_start < $beginning_of_start_timestamp) { $start = date('Y-m-d', strtotime('-1 day', strtotime($start))); } // Subtract a day from the $end if it is: // * earlier than the beginning of the start DATE OR // * earlier than the beginning of the end DATE OR // * earlier than the end of the start DATE (as long as the beginning of the end DATE is greater than that of the start DATE) // // Example 1: // Assuming a cut-off of 6:00am and an event end date/time of August 2nd @ 7:00am. The // "end" DATE would be August 2nd and the beginning of the "end" DATE would be August // 2nd @ 6:00am. Therefore, the event end DATE shoud remain as August 2nd. (Note: the // following if statement conditional would be false) // // Example 2: // Assuming a cut-off of 6:00am and an event end date/time of August 2nd @ 5:00am. The // "end" DATE would be August 2nd and the beginning of the "end" DATE would be August // 2nd @ 6:00am. Therefore, the event end DATE shoud be altered to be a day earlier // (August 1st) (Note: this following if statement conditional would be true) if ($event_end < $beginning_of_start_timestamp || $event_end < $beginning_of_end_timestamp || $event_end < $end_of_start_timestamp && $beginning_of_end_timestamp > $end_of_start_timestamp) { $end = date('Y-m-d', strtotime('-1 day', strtotime($end))); } // determine if there's a difference in days between start and end $diff = strtotime($end) - strtotime($start); if ($diff > 0) { // There IS a difference. How many days? $diff_in_days = $diff / DAY_IN_SECONDS; // add the event to each day until the event end $new_start = $start; for ($i = 0; $i <= $diff_in_days; $i++) { if (!isset($this->event_ids_by_day[$new_start])) { $this->event_ids_by_day[$new_start] = array(); } $this->event_ids_by_day[$new_start][] = $event->ID; $new_start = date('Y-m-d', strtotime('+1 day', strtotime($new_start))); } } else { // nope. The event is a single day event. Add it to the array if (!isset($this->event_ids_by_day[$start])) { $this->event_ids_by_day[$start] = array(); } $this->event_ids_by_day[$start][] = $event->ID; } } // Now that we've built our event_ids_by_day, let's array_unique and sort foreach ($this->event_ids_by_day as &$day) { $day = array_unique($day); sort($day); } } if (empty($this->event_ids_by_day[$date])) { return array(); } return $this->event_ids_by_day[$date]; }
if (isset($postconfig['event_room']) && !empty($postconfig['event_room'])) { $room = $postconfig['event_room']; } ?> <article <?php post_class('tribe-events-item'); ?> > <div class="row"> <div class="col-sm-2"> <div class="event-date"> <?php if (trim(tribe_get_start_date(get_the_ID(), false, 'Y-m-d')) != trim($event_date)) { echo '00:00'; } else { echo tribe_get_start_date(get_the_ID(), false, 'H:i'); } ?> <span>-</span> <?php if (trim(tribe_get_end_date(get_the_ID(), false, 'Y-m-d')) != trim($event_date)) { echo '23:59'; } else { echo tribe_get_end_date(get_the_ID(), false, 'H:i'); } ?> </div> <div class="clearfix"></div> <div class="event_room text-right"> <span><?php echo esc_html($room);
* */ if (!defined('ABSPATH')) { die('-1'); } //Check if any posts were found if ($posts) { ?> <ol class="hfeed vcalendar"> <?php foreach ($posts as $post) { setup_postdata($post); $time_format = get_option('time_format', TribeDateUtils::TIMEFORMAT); $time_range_separator = tribe_get_option('timeRangeSeparator', ' - '); $start_time = tribe_get_start_date($event, false, $time_format); $end_time = tribe_get_end_date($event, false, $time_format); ?> <li class="tribe-events-list-widget-events <?php tribe_events_event_classes(); ?> "> <div class="event-info-box"> <div class="event-date"> <span class="icon-calendar"><?php echo date('j M', strtotime($post->EventStartDate)); ?> </span> </div> <div class="event-time">
$the_query = new WP_Query($args); // The Loop while ($the_query->have_posts()) { $the_query->the_post(); ?> <li> <article> <a href="<?php the_permalink(); ?> "> <?php the_title(); ?> <span class="meta eventdate"><?php echo tribe_get_start_date($post->ID, false, 'j M'); ?> </span> </a> </article> </li> <?php } ?> <!--Restore original Query & Post Data--> <?php wp_reset_query(); wp_reset_postdata(); ?> </ul>
/** * Add the custom columns. * * @param string $column_id The custom column id. * @param int $post_id The post id for the data. * */ public static function custom_columns($column_id, $post_id) { switch ($column_id) { case 'events-cats': $event_cats = get_the_term_list($post_id, Tribe__Events__Main::TAXONOMY, '', ', ', ''); echo $event_cats ? strip_tags($event_cats) : '—'; break; case 'start-date': echo tribe_get_start_date($post_id, false); break; case 'end-date': echo tribe_get_display_end_date($post_id, false); break; } }
<div id="tribe-filters" class="metabox-holder"> <div id="filters-wrap" class="postbox"> <h3 title="Click to toggle"><?php _e('Event Summary', 'tribe-events-calendar'); ?> </h3> <table class="eventtable ticket_list"> <tr> <td width="33%" valign="top"> <?php echo sprintf('<h4>%s</h4>', esc_html(__('Event Details', 'tribe-events-calendar'))); echo sprintf('<strong>%s </strong> %s', esc_html(__('Start Date / Time:', 'tribe-events-calendar')), tribe_get_start_date($event_id, false, get_option('date_format') . ' ' . get_option('time_format'))); echo "<br/>"; echo sprintf('<strong>%s </strong> %s', esc_html(__('End Date / Time:', 'tribe-events-calendar')), tribe_get_end_date($event_id, false, get_option('date_format') . ' ' . get_option('time_format'))); $venue_id = tribe_get_venue_id($event_id); if (!empty($venue_id)) { $venue = get_post($venue_id); } if (!empty($venue)) { echo "<br/>"; echo sprintf('<strong>%s </strong> %s', esc_html(__('Venue:', 'tribe-events-calendar')), esc_html($venue->post_title)); $phone = get_post_meta($venue_id, '_VenuePhone', true); if (!empty($phone)) { echo "<br/>"; echo sprintf('<strong>%s </strong> %s', esc_html(__('Phone:', 'tribe-events-calendar')), esc_html($phone)); } $website = get_post_meta($venue_id, '_VenueURL', true);