Example #1
0
 /**
  * End Date
  *
  * Returns the event end date
  *
  * @param int $event (optional)
  * @param bool $displayTime If true shows date and time, if false only shows date
  * @param string $dateFormat Allows date and time formating using standard php syntax (http://php.net/manual/en/function.date.php)
  * @return string Date
  */
 function tribe_get_end_date($event = null, $displayTime = true, $dateFormat = '')
 {
     if (is_null($event)) {
         global $post;
         $event = $post;
     }
     if (is_numeric($event)) {
         $event = get_post($event);
     }
     if (tribe_event_is_all_day($event)) {
         $displayTime = false;
     }
     if (empty($event->EventEndDate) && is_object($event)) {
         $event->EventEndDate = tribe_get_event_meta($event->ID, '_EventEndDate', true);
     }
     if (isset($event->EventEndDate)) {
         if (tribe_event_is_all_day($event) && empty($event->_end_date_fixed) && TribeDateUtils::timeOnly($event->EventEndDate) != '23:59:59' && TribeDateUtils::timeOnly(tribe_event_end_of_day()) != '23:59') {
             // set the event end date to be one day earlier, if it's an all day event and the cutoff is past midnight
             // @todo remove this once we can have all day events without a start / end time
             $event->EventEndDate = date_create($event->EventEndDate);
             $event->EventEndDate->modify('-1 day');
             $event->EventEndDate = $event->EventEndDate->format(TribeDateUtils::DBDATEFORMAT);
             $event->_end_date_fixed = true;
         }
         $date = strtotime($event->EventEndDate);
     } else {
         return;
     }
     return tribe_event_format_date($date, $displayTime, $dateFormat);
 }
Example #2
0
/**
 * Output a link for the mini calendar month previous nav, includes data attributes needed to update the month with ajax
 *
 * @return void
 **/
function tribe_events_the_mini_calendar_title()
{
    $args = tribe_events_get_mini_calendar_args();
    $date = strtotime($args['eventDate']);
    $date_format = tribe_get_option('monthAndYearFormat', 'M Y');
    $title = tribe_event_format_date($date, false, $date_format);
    echo apply_filters('tribe_events_the_mini_calendar_title', $title);
}
Example #3
0
 /**
  * End Date
  *
  * Returns the event end date
  *
  * @param int $postId (optional) this only works for non recurring events
  * @param bool $displayTime If true shows date and time, if false only shows date
  * @param string $dateFormat Allows date and time formating using standard php syntax (http://php.net/manual/en/function.date.php)
  * @return string Date
  * @todo support $postId for recurring events.
  * @since 2.0
  */
 function tribe_get_end_date($postId = null, $displayTime = 'true', $dateFormat = '')
 {
     $postId = TribeEvents::postIdHelper($postId);
     if (!$postId || function_exists('tribe_is_recurring_event') && tribe_is_recurring_event($postId)) {
         global $post;
     } else {
         $post = get_post($postId);
     }
     if (tribe_get_all_day($postId)) {
         $displayTime = false;
     }
     if (empty($post->EventEndDate)) {
         $post->EventEndDate = tribe_get_event_meta($postId, '_EventEndDate', true);
     }
     if (isset($post->EventEndDate)) {
         $date = strtotime($post->EventEndDate);
     } else {
         return;
         // '—';
     }
     return tribe_event_format_date($date, $displayTime, $dateFormat);
 }
Example #4
0
 /**
  * End Date
  *
  * Returns the event end date
  *
  * @param int $event (optional) this only works for non recurring events
  * @param bool $displayTime If true shows date and time, if false only shows date
  * @param string $dateFormat Allows date and time formating using standard php syntax (http://php.net/manual/en/function.date.php)
  * @return string Date
  * @todo support $postId for recurring events.
  * @since 2.0
  */
 function tribe_get_end_date($event = null, $displayTime = true, $dateFormat = '')
 {
     if (is_null($event)) {
         global $post;
         $event = $post;
     }
     if (is_numeric($event)) {
         $event = get_post($event);
     }
     if (tribe_event_is_all_day($event)) {
         $displayTime = false;
     }
     if (empty($event->EventEndDate) && is_object($event)) {
         $event->EventEndDate = tribe_get_event_meta($event->ID, '_EventEndDate', true);
     }
     if (isset($event->EventEndDate)) {
         $date = strtotime($event->EventEndDate);
     } else {
         return;
         // '—';
     }
     return tribe_event_format_date($date, $displayTime, $dateFormat);
 }
Example #5
0
function tribe_mini_display_day($day, $monthView, $month = NULL, $date = NULL)
{
    $tribe_ecp = TribeEvents::instance();
    $monthName = $tribe_ecp->monthsShort[date('M', $date)];
    $dayofweeek = tribe_event_format_date(false, 'D');
    $return = "<div class='daynum tribe-events-event' id='daynum_{$day}'>";
    $return .= count($monthView[$day]) ? "<a class='tribe-events-mini-has-event'><span class='tribe-month-name'>{$monthName} {$dayofweeek}</span>{$day}</a>" : $day;
    /**/
    $return .= "<div id='tooltip_day_{$day}' class='tribe-events-tooltip' style='display:none;'>";
    for ($i = 0; $i < count($monthView[$day]); $i++) {
        $post = $monthView[$day][$i];
        setup_postdata($post);
        $return .= '<h5 class="tribe-events-event-title-mini"><a href="' . tribe_get_event_link($post) . '">' . $post->post_title . '</a></h5>';
    }
    //$return .= '<span class="tribe-events-arrow"></span>';
    $return .= '</div>';
    /**/
    $return .= "</div>";
    return $return;
}
Example #6
0
			<td class="<?php 
    tribe_events_the_month_day_classes();
    ?>
"
				<?php 
    if (isset($daydata['daynum'])) {
        ?>
					data-day="<?php 
        echo $daydata['date'];
        ?>
"
					<?php 
        //Add Day Name Option for Responsive Header
        if ($daydata['total_events'] > 0) {
            $day_name = tribe_event_format_date($daydata['date'], false);
            ?>
						data-date-name="<?php 
            echo $day_name;
            ?>
"
					<?php 
        }
        ?>

				<?php 
    }
    ?>
				>
				<?php 
    tribe_get_template_part('month/single', 'day');
Example #7
0
 /**
  * Returns various internal events-related URLs
  *
  * @param string        $type      type of link. See switch statement for types.
  * @param string        $secondary for $type = month, pass a YYYY-MM string for a specific month's URL
  *                                 for $type = week, pass a Week # string for a specific week's URL
  * @param int|bool|null $term
  *
  * @return string The link.
  */
 public function getLink($type = 'home', $secondary = false, $term = null)
 {
     // if permalinks are off or user doesn't want them: ugly.
     if ('' == get_option('permalink_structure')) {
         return esc_url_raw($this->uglyLink($type, $secondary));
     }
     // account for semi-pretty permalinks
     if (false !== strpos(get_option('permalink_structure'), 'index.php')) {
         $eventUrl = trailingslashit(home_url() . '/index.php/' . sanitize_title($this->getOption('eventsSlug', 'events')));
     } else {
         $eventUrl = trailingslashit(home_url() . '/' . sanitize_title($this->getOption('eventsSlug', 'events')));
     }
     // if we're on an Event Cat, show the cat link, except for home and days.
     if ($type !== 'home' && is_tax(self::TAXONOMY) && $term !== false && !is_numeric($term)) {
         $term_link = get_term_link(get_query_var('term'), self::TAXONOMY);
         if (!is_wp_error($term_link)) {
             $eventUrl = trailingslashit($term_link);
         }
     } else {
         if ($term) {
             $term_link = get_term_link((int) $term, self::TAXONOMY);
             if (!is_wp_error($term_link)) {
                 $eventUrl = trailingslashit($term_link);
             }
         }
     }
     switch ($type) {
         case 'home':
             $eventUrl = trailingslashit(esc_url_raw($eventUrl));
             break;
         case 'month':
             if ($secondary) {
                 $eventUrl = trailingslashit(esc_url_raw($eventUrl . $secondary));
             } else {
                 $eventUrl = trailingslashit(esc_url_raw($eventUrl . $this->monthSlug));
             }
             break;
         case 'list':
             $eventUrl = trailingslashit(esc_url_raw($eventUrl . $this->listSlug));
             break;
         case 'upcoming':
             $eventUrl = trailingslashit(esc_url_raw($eventUrl . $this->listSlug));
             break;
         case 'past':
             $eventUrl = esc_url_raw(add_query_arg('tribe_event_display', 'past', trailingslashit($eventUrl . $this->listSlug)));
             break;
         case 'dropdown':
             $eventUrl = esc_url_raw($eventUrl);
             break;
         case 'single':
             global $post;
             $p = $secondary ? $secondary : $post;
             $link = trailingslashit(get_permalink($p));
             $eventUrl = trailingslashit(esc_url_raw($link));
             break;
         case 'day':
             if (empty($secondary)) {
                 $secondary = $this->todaySlug;
             } else {
                 $secondary = tribe_event_format_date($secondary, false, Tribe__Events__Date_Utils::DBDATEFORMAT);
             }
             $eventUrl = trailingslashit(esc_url_raw($eventUrl . $secondary));
             break;
         default:
             $eventUrl = esc_url_raw($eventUrl);
             break;
     }
     return apply_filters('tribe_events_getLink', $eventUrl, $type, $secondary, $term);
 }
 /**
  * Event Title
  *
  * Return an event's title with pseudo-breadcrumb if on a category
  *
  * @param bool $depth include linked title
  *
  * @return string title
  * @todo move logic to template classes
  */
 function tribe_get_events_title($depth = true)
 {
     $events_label_plural = tribe_get_event_label_plural();
     global $wp_query;
     $tribe_ecp = Tribe__Events__Main::instance();
     $title = sprintf(__('Upcoming %s', 'tribe-events-calendar'), $events_label_plural);
     // If there's a date selected in the tribe bar, show the date range of the currently showing events
     if (isset($_REQUEST['tribe-bar-date']) && $wp_query->have_posts()) {
         if ($wp_query->get('paged') > 1) {
             // if we're on page 1, show the selected tribe-bar-date as the first date in the range
             $first_event_date = tribe_get_start_date($wp_query->posts[0], false);
         } else {
             //otherwise show the start date of the first event in the results
             $first_event_date = tribe_event_format_date($_REQUEST['tribe-bar-date'], false);
         }
         $last_event_date = tribe_get_end_date($wp_query->posts[count($wp_query->posts) - 1], false);
         $title = sprintf(__('%1$s for %2$s - %3$s', 'tribe-events-calendar'), $events_label_plural, $first_event_date, $last_event_date);
     } elseif (tribe_is_past()) {
         $title = sprintf(__('Past %s', 'tribe-events-calendar'), $events_label_plural);
     }
     if (tribe_is_month()) {
         $title = sprintf(__('%1$s for %2$s', 'tribe-events-calendar'), $events_label_plural, date_i18n(tribe_get_option('monthAndYearFormat', 'F Y'), strtotime(tribe_get_month_view_date())));
     }
     // day view title
     if (tribe_is_day()) {
         $title = sprintf(__('%1$s for %2$s', 'tribe-events-calendar'), $events_label_plural, date_i18n(tribe_get_date_format(true), strtotime($wp_query->get('start_date'))));
     }
     if (is_tax($tribe_ecp->get_event_taxonomy()) && $depth) {
         $cat = get_queried_object();
         $title = '<a href="' . esc_url(tribe_get_events_link()) . '">' . $title . '</a>';
         $title .= ' &#8250; ' . $cat->name;
     }
     return apply_filters('tribe_get_events_title', $title, $depth);
 }
Example #9
0
				<h4 class="event-day"><?php 
            echo tribe_get_start_date(null, false);
            ?>
 – <?php 
            echo tribe_get_end_date(null, false);
            ?>
</h4>
			<?php 
        }
        ?>
			<?php 
        if (tribe_is_day() && $first) {
            $first = false;
            ?>
				<h4 class="event-day"><?php 
            echo tribe_event_format_date(strtotime(get_query_var('eventDate')), false);
            ?>
</h4>
			<?php 
        }
        ?>
			<?php 
        the_title('<h2 class="entry-title" itemprop="name"><a href="' . tribe_get_event_link() . '" title="' . the_title_attribute('echo=0') . '" rel="bookmark">', '</a></h2>');
        ?>
			<div class="entry-content tribe-events-event-entry" itemprop="description">
				<?php 
        if (has_excerpt()) {
            ?>
					<?php 
            the_excerpt();
            ?>
 /**
  * Add the custom columns.
  *
  * @param string $column_id The custom column id.
  * @param int $post_id The post id for the data.
  * @return void
  */
 public static function custom_columns($column_id, $post_id)
 {
     if (self::$events_list && sizeof(self::$events_list) > 0) {
         if ($column_id == 'events-cats') {
             $event_cats = get_the_term_list($post_id, TribeEvents::TAXONOMY, '', ', ', '');
             echo $event_cats ? strip_tags($event_cats) : '—';
         }
         if ($column_id == 'start-date') {
             if (!empty(self::$events_list[0]->EventStartDate)) {
                 echo tribe_event_format_date(strtotime(self::$events_list[0]->EventStartDate), false);
             }
             if (!self::$end_col_active || !self::$start_col_first) {
                 self::advance_date();
             }
         }
         if ($column_id == 'end-date') {
             if (!empty(self::$events_list[0]->EventEndDate)) {
                 echo tribe_event_format_date(strtotime(self::$events_list[0]->EventEndDate), false);
             }
             if (self::$start_col_first) {
                 self::advance_date();
             }
         }
         if ($column_id == 'recurring') {
             echo sizeof(get_post_meta($post_id, '_EventStartDate')) > 1 ? __("Yes", 'tribe-events-calendar') : __("No", 'tribe-events-calendar');
         }
     } else {
         self::ajax_custom_columns($column_id, $post_id);
     }
 }
Example #11
0
 /**
  * End Date
  *
  * Returns the event end date
  *
  * @category Events
  * @param int    $event       (optional)
  * @param bool   $displayTime If true shows date and time, if false only shows date
  * @param string $dateFormat  Allows date and time formating using standard php syntax (http://php.net/manual/en/function.date.php)
  * @param string $timezone    Timezone in which to present the date/time (or default behaviour if not set)
  *
  * @return string|null Date
  */
 function tribe_get_end_date($event = null, $displayTime = true, $dateFormat = '', $timezone = null)
 {
     if (is_null($event)) {
         global $post;
         $event = $post;
     }
     if (is_numeric($event)) {
         $event = get_post($event);
     }
     if (!is_object($event)) {
         return '';
     }
     if (tribe_event_is_all_day($event)) {
         $displayTime = false;
     }
     $end_date = Tribe__Events__Timezones::event_end_timestamp($event->ID, $timezone);
     return tribe_event_format_date($end_date, $displayTime, $dateFormat);
 }
Example #12
0
							</td>
						<?php 
        }
        ?>

						<td>
						<?php 
        $start_date = strtotime($post->EventStartDate);
        echo tribe_event_format_date($start_date, false, TribeCommunityEvents::instance()->eventListDateFormat);
        ?>
						</td>

						<td>
						<?php 
        $end_date = strtotime($post->EventEndDate);
        echo tribe_event_format_date($end_date, false, TribeCommunityEvents::instance()->eventListDateFormat);
        ?>
						</td>

					</tr>

				<?php 
    }
    // end list loop
    $post = $old_post;
    ?>

			</tbody><!-- #the-list -->

			<?php 
    do_action('tribe_ce_after_event_list_table');
			<?php 
    // Get data for this day within the loop.
    $daydata = tribe_events_get_current_month_day();
    ?>

			<td class="<?php 
    tribe_events_the_month_day_classes();
    ?>
"
				data-day="<?php 
    echo esc_attr(isset($daydata['daynum']) ? $daydata['date'] : '');
    ?>
"
				data-tribejson='<?php 
    echo tribe_events_template_data(null, array('date_name' => tribe_event_format_date($daydata['date'], false)));
    ?>
'
				>
				<?php 
    tribe_get_template_part('month/single', 'day');
    ?>
			</td>
			<?php 
}
?>
		</tr>
		</tbody>
	</table><!-- .tribe-events-calendar -->
<?php 
do_action('tribe_events_after_the_grid');
Example #14
0
 /**
  * Is hooked by init() filter to parse the WP_Query arguments for main and alt queries.
  *
  * @param object $query WP_Query object args supplied or default
  *
  * @return object $query (modified)
  */
 public static function pre_get_posts($query)
 {
     $admin_helpers = Tribe__Events__Admin__Helpers::instance();
     if ($query->is_main_query() && is_home()) {
         // check option for including events in the main wordpress loop, if true, add events post type
         if (tribe_get_option('showEventsInMainLoop', false)) {
             $query->query_vars['post_type'] = isset($query->query_vars['post_type']) ? (array) $query->query_vars['post_type'] : array('post');
             $query->query_vars['post_type'][] = Tribe__Events__Main::POSTTYPE;
             $query->tribe_is_multi_posttype = true;
         }
     }
     if ($query->tribe_is_multi_posttype) {
         do_action('log', 'multi_posttype', 'default', $query->tribe_is_multi_posttype);
         add_filter('posts_fields', array(__CLASS__, 'multi_type_posts_fields'), 10, 2);
         add_filter('posts_join', array(__CLASS__, 'posts_join'), 10, 2);
         add_filter('posts_join', array(__CLASS__, 'posts_join_orderby'), 10, 2);
         add_filter('posts_distinct', array(__CLASS__, 'posts_distinct'));
         add_filter('posts_orderby', array(__CLASS__, 'posts_orderby'), 10, 2);
         do_action('tribe_events_pre_get_posts', $query);
         return;
     }
     if ($query->tribe_is_event || $query->tribe_is_event_category) {
         if (!($query->is_main_query() && 'month' === $query->get('eventDisplay'))) {
             add_filter('posts_fields', array(__CLASS__, 'posts_fields'), 10, 2);
             add_filter('posts_join', array(__CLASS__, 'posts_join'), 10, 2);
             add_filter('posts_join', array(__CLASS__, 'posts_join_orderby'), 10, 2);
             add_filter('posts_where', array(__CLASS__, 'posts_where'), 10, 2);
             add_filter('posts_distinct', array(__CLASS__, 'posts_distinct'));
         } else {
             // reduce number of queries triggered by main WP_Query on month view
             $query->set('posts_per_page', 1);
             $query->set('no_found_rows', true);
             $query->set('cache_results', false);
             $query->set('update_post_meta_cache', false);
             $query->set('update_post_term_cache', false);
             do_action('tribe_events_pre_get_posts', $query);
             return $query;
         }
         // if a user selects a date in the event bar we want it to persist as long as possible
         if (!empty($_REQUEST['tribe-bar-date'])) {
             $query->set('eventDate', $_REQUEST['tribe-bar-date']);
             do_action('log', 'changed eventDate to tribe-bar-date', 'tribe-events-query', $_REQUEST['tribe-bar-date']);
         }
         // if a user provides a search term we want to use that in the search params
         if (!empty($_REQUEST['tribe-bar-search'])) {
             $query->query_vars['s'] = $_REQUEST['tribe-bar-search'];
         }
         $query->query_vars['eventDisplay'] = !empty($query->query_vars['eventDisplay']) ? $query->query_vars['eventDisplay'] : Tribe__Events__Main::instance()->displaying;
         //@todo stop calling EOD cutoff transformations all over the place
         if (!empty($query->query_vars['eventDisplay'])) {
             switch ($query->query_vars['eventDisplay']) {
                 case 'custom':
                     // if the eventDisplay is 'custom', all we're gonna do is make sure the start and end dates are formatted
                     $start_date = $query->get('start_date');
                     if ($start_date) {
                         $query->set('start_date', date_i18n(Tribe__Events__Date_Utils::DBDATETIMEFORMAT, strtotime($start_date)));
                     }
                     $end_date = $query->get('end_date');
                     if ($end_date) {
                         $query->set('end_date', date_i18n(Tribe__Events__Date_Utils::DBDATETIMEFORMAT, strtotime($end_date)));
                     }
                     break;
                 case 'month':
                     // make sure start and end date are set
                     if ($query->get('start_date') == '') {
                         $event_date = $query->get('eventDate') != '' ? $query->get('eventDate') : date_i18n(Tribe__Events__Date_Utils::DBDATETIMEFORMAT);
                         $query->set('start_date', tribe_event_beginning_of_day($event_date));
                     }
                     if ($query->get('end_date' == '')) {
                         $query->set('end_date', tribe_event_end_of_day($query->get('start_date')));
                     }
                     $query->set('hide_upcoming', true);
                     break;
                 case 'day':
                     $event_date = $query->get('eventDate') != '' ? $query->get('eventDate') : Date('Y-m-d', current_time('timestamp'));
                     $query->set('eventDate', $event_date);
                     $beginning_of_day = strtotime(tribe_event_beginning_of_day($event_date)) + 1;
                     $query->set('start_date', date_i18n(Tribe__Events__Date_Utils::DBDATETIMEFORMAT, $beginning_of_day));
                     $query->set('end_date', tribe_event_end_of_day($event_date));
                     $query->set('posts_per_page', -1);
                     // show ALL day posts
                     $query->set('hide_upcoming', true);
                     $query->set('order', self::set_order('ASC', $query));
                     break;
                 case 'single-event':
                     if ($query->get('eventDate') != '') {
                         $query->set('start_date', $query->get('eventDate'));
                         $query->set('eventDate', $query->get('eventDate'));
                     }
                     break;
                 case 'all':
                 case 'list':
                 default:
                     // default display query
                     $event_date = $query->get('eventDate') != '' ? $query->get('eventDate') : date_i18n(Tribe__Events__Date_Utils::DBDATETIMEFORMAT);
                     if (!$query->tribe_is_past) {
                         $query->set('start_date', '' != $query->get('eventDate') ? tribe_event_beginning_of_day($event_date) : tribe_event_format_date(current_time('timestamp'), true, 'Y-m-d H:i:s'));
                         $query->set('end_date', '');
                         $query->set('order', self::set_order('ASC', $query));
                     } else {
                         // on past view, set the passed date as the end date
                         $query->set('start_date', '');
                         $query->set('end_date', tribe_event_end_of_day($event_date));
                         $query->set('order', self::set_order('DESC', $query));
                     }
                     $query->set('orderby', self::set_orderby(null, $query));
                     $query->set('hide_upcoming', true);
                     break;
             }
         } else {
             $query->set('hide_upcoming', true);
             $query->set('start_date', date_i18n(Tribe__Events__Date_Utils::DBDATETIMEFORMAT));
             $query->set('orderby', self::set_orderby(null, $query));
             $query->set('order', self::set_order(null, $query));
         }
         // eventCat becomes a standard taxonomy query - will need to deprecate and update views eventually
         if (!in_array($query->get(Tribe__Events__Main::TAXONOMY), array('', '-1'))) {
             $tax_query[] = array('taxonomy' => Tribe__Events__Main::TAXONOMY, 'field' => is_numeric($query->get(Tribe__Events__Main::TAXONOMY)) ? 'id' : 'slug', 'terms' => $query->get(Tribe__Events__Main::TAXONOMY), 'include_children' => apply_filters('tribe_events_query_include_children', true));
         }
         // Only add the postmeta hack if it's not the main admin events list
         // Because this method filters out drafts without EventStartDate.
         // For this screen we're doing the JOIN manually in Tribe__Events__Admin_List
         if (!Tribe__Events__Admin__Helpers::instance()->is_screen('edit-tribe_events')) {
             $event_start_key = Tribe__Events__Timezones::is_mode('site') ? '_EventStartDateUTC' : '_EventStartDate';
             $meta_query[] = array('key' => $event_start_key, 'type' => 'DATETIME');
         }
     }
     // filter by Venue ID
     if ($query->tribe_is_event_query && $query->get('venue') != '') {
         $meta_query[] = array('key' => '_EventVenueID', 'value' => $query->get('venue'));
     }
     // filter by Organizer ID
     if ($query->tribe_is_event_query && $query->get('organizer') != '') {
         $meta_query[] = array('key' => '_EventOrganizerID', 'value' => $query->get('organizer'));
     }
     // enable pagination setup
     if ($query->tribe_is_event_query && $query->get('posts_per_page') == '') {
         $query->set('posts_per_page', (int) tribe_get_option('postsPerPage', 10));
     }
     // hide upcoming events from query (only not in admin)
     if ($query->tribe_is_event_query && $query->get('hide_upcoming') && !$query->get('suppress_filters')) {
         $hide_upcoming_ids = self::getHideFromUpcomingEvents();
         if (!empty($hide_upcoming_ids)) {
             $query->set('post__not_in', $hide_upcoming_ids);
         }
     }
     if ($query->tribe_is_event_query && !empty($meta_query)) {
         // setup default relation for meta queries
         $meta_query['relation'] = 'AND';
         $meta_query_combined = array_merge((array) $meta_query, (array) $query->get('meta_query'));
         $query->set('meta_query', $meta_query_combined);
     }
     if ($query->tribe_is_event_query && !empty($tax_query)) {
         // setup default relation for tax queries
         $tax_query_combined = array_merge((array) $tax_query, (array) $query->get('tax_query'));
         $query->set('tax_query', $tax_query_combined);
     }
     if ($query->tribe_is_event_query) {
         add_filter('posts_orderby', array(__CLASS__, 'posts_orderby'), 10, 2);
     }
     // if is in the admin remove the event date & upcoming filters, unless is an ajax call
     if (is_admin() && $query->tribe_is_event_query && $admin_helpers->is_screen('edit-' . Tribe__Events__Main::POSTTYPE)) {
         if (!defined('DOING_AJAX') || defined('DOING_AJAX') && !DOING_AJAX) {
             remove_filter('posts_where', array(__CLASS__, 'posts_where'), 10, 2);
             remove_filter('posts_fields', array(__CLASS__, 'posts_fields'));
             $query->set('post__not_in', '');
             // set the default order for posts within admin lists
             if (!isset($query->query['order'])) {
                 $query->set('order', 'DESC');
             } else {
                 // making sure we preserve the order supplied by the query string even if it is overwritten above
                 $query->set('order', $query->query['order']);
             }
         }
     }
     if ($query->tribe_is_event_query) {
         do_action('tribe_events_pre_get_posts', $query);
     }
     return $query;
 }
Example #15
0
 /**
  * Returns various internal events-related URLs
  *
  * @param string        $type      type of link. See switch statement for types.
  * @param string        $secondary for $type = month, pass a YYYY-MM string for a specific month's URL
  *                                 for $type = week, pass a Week # string for a specific week's URL
  * @param int|bool|null $term
  *
  * @return string The link.
  */
 public function getLink($type = 'home', $secondary = false, $term = null)
 {
     // if permalinks are off or user doesn't want them: ugly.
     if ('' === get_option('permalink_structure')) {
         return esc_url_raw($this->uglyLink($type, $secondary));
     }
     // account for semi-pretty permalinks
     if (false !== strpos(get_option('permalink_structure'), 'index.php')) {
         $event_url = home_url('/index.php/');
     } else {
         $event_url = home_url('/');
     }
     // URL Arguments on home_url() pre-check
     $url_query = @parse_url($event_url, PHP_URL_QUERY);
     $url_args = wp_parse_args($url_query, array());
     // Remove the "args"
     if (!empty($url_query)) {
         $event_url = str_replace('?' . $url_query, '', $event_url);
     }
     // Append Events structure
     $event_url .= trailingslashit(sanitize_title($this->getOption('eventsSlug', 'events')));
     // if we're on an Event Cat, show the cat link, except for home and days.
     if ($type !== 'home' && is_tax(self::TAXONOMY) && $term !== false && !is_numeric($term)) {
         $term_link = get_term_link(get_query_var('term'), self::TAXONOMY);
         if (!is_wp_error($term_link)) {
             $event_url = trailingslashit($term_link);
         }
     } else {
         if ($term) {
             $term_link = get_term_link((int) $term, self::TAXONOMY);
             if (!is_wp_error($term_link)) {
                 $event_url = trailingslashit($term_link);
             }
         }
     }
     switch ($type) {
         case 'home':
             $event_url = trailingslashit(esc_url_raw($event_url));
             break;
         case 'month':
             if ($secondary) {
                 $event_url = trailingslashit(esc_url_raw($event_url . $secondary));
             } else {
                 $event_url = trailingslashit(esc_url_raw($event_url . $this->monthSlug));
             }
             break;
         case 'list':
             $event_url = trailingslashit(esc_url_raw($event_url . $this->listSlug));
             break;
         case 'upcoming':
             $event_url = trailingslashit(esc_url_raw($event_url . $this->listSlug));
             break;
         case 'past':
             $event_url = esc_url_raw(add_query_arg('tribe_event_display', 'past', trailingslashit($event_url . $this->listSlug)));
             break;
         case 'dropdown':
             $event_url = esc_url_raw($event_url);
             break;
         case 'single':
             global $post;
             $p = $secondary ? $secondary : $post;
             $link = trailingslashit(get_permalink($p));
             $event_url = trailingslashit(esc_url_raw($link));
             break;
         case 'day':
             if (empty($secondary)) {
                 $secondary = $this->todaySlug;
             } else {
                 $secondary = tribe_event_format_date($secondary, false, Tribe__Events__Date_Utils::DBDATEFORMAT);
             }
             $event_url = trailingslashit(esc_url_raw($event_url . $secondary));
             break;
         default:
             $event_url = esc_url_raw($event_url);
             break;
     }
     // Filter get link
     $event_url = apply_filters('tribe_events_get_link', $event_url, $type, $secondary, $term, $url_args);
     // @todo deprecate on 4.2
     $event_url = apply_filters('tribe_events_getLink', $event_url, $type, $secondary, $term, $url_args);
     // Add the Arguments back
     $event_url = add_query_arg($url_args, $event_url);
     return $event_url;
 }
if ($title) {
    ?>
      <h3 class="widget-title visual-title <?php 
    echo esc_attr($size) . ' ' . $alignment;
    ?>
">
      </h3>
   <?php 
}
?>

   <div class="widget-content">
      <div class="row">
         <div class="col-xs-12">
            <div class="date-heading"><?php 
echo tribe_event_format_date($event_date, false, 'd M Y');
?>
</div>
         </div>
      </div>
      <div class="events-timeline">
         <?php 
if ($query->have_posts()) {
    while ($query->have_posts()) {
        $query->the_post();
        $i = $query->current_post + 1;
        $_imgs = training_wpo_gallieries();
        $galleries = array();
        foreach ($_imgs as $val) {
            if ($val) {
                $galleries[] = $val;
</p>
                    <?php 
            }
            $content = the_content();
            ?>
                <?php 
        }
    }
}
?>
    </section>

    <section class="calendar-month-view">
        <h2 class="calendar-month-title">Outing Schedule</h2> 
        <h3 class="month-year"><?php 
echo tribe_event_format_date($date, $displayTime = false, $dateFormat = 'F Y');
?>
</h3>
        <?php 
tribe_show_month();
?>
    </section>


<script src="<?php 
echo get_stylesheet_directory_uri();
?>
/js/header-slider.js"></script>

<?php 
get_footer();