function form($instance)
 {
     $defaults = array('title' => '', 'event_ID' => null, 'event_date' => null, 'show_seconds' => true, 'complete' => 'Hooray!');
     $instance = wp_parse_args((array) $instance, $defaults);
     $events = tribe_get_events(array('eventDisplay' => 'upcoming', 'posts_per_page' => '-1'));
     include TribeEventsPro::instance()->pluginPath . 'admin-views/widget-admin-countdown.php';
 }
示例#2
0
 function widget($args, $instance)
 {
     extract($args);
     extract($instance);
     if (empty($hide_if_empty)) {
         $hide_if_empty = false;
     }
     // Get all the upcoming events for this venue.
     $events = tribe_get_events(array('post_type' => TribeEvents::POSTTYPE, 'venue' => $venue_ID, 'posts_per_page' => $count, 'eventDisplay' => 'upcoming'), true);
     // If there are no events, and the user has set to hide if empty, don't display the widget.
     if ($hide_if_empty && !$events->have_posts()) {
         return;
     }
     $ecp = TribeEventsPro::instance();
     $tooltip_status = $ecp->recurring_info_tooltip_status();
     $ecp->disable_recurring_info_tooltip();
     echo $before_widget;
     do_action('tribe_events_venue_widget_before_the_title');
     echo $instance['title'] ? $args['before_title'] . $instance['title'] . $args['after_title'] : '';
     do_action('tribe_events_venue_widget_after_the_title');
     include TribeEventsTemplates::getTemplateHierarchy('pro/widgets/venue-widget.php');
     echo $after_widget;
     if ($tooltip_status) {
         $ecp->enable_recurring_info_tooltip();
     }
     wp_reset_postdata();
 }
示例#3
0
 public function widget($args, $instance)
 {
     extract($args);
     extract($instance);
     if (empty($hide_if_empty)) {
         $hide_if_empty = false;
     }
     $event_args = array('post_type' => Tribe__Events__Main::POSTTYPE, 'venue' => $venue_ID, 'posts_per_page' => $count, 'eventDisplay' => 'list', 'tribe_render_context' => 'widget');
     /**
      * Filter Venue Widget tribe_get_event args
      *
      * @param array $event_args Arguments for the Venue Widget's call to tribe_get_events
      */
     $event_args = apply_filters('tribe_events_pro_venue_widget_event_query_args', $event_args);
     // Get all the upcoming events for this venue.
     $events = tribe_get_events($event_args, true);
     // If there are no events, and the user has set to hide if empty, don't display the widget.
     if ($hide_if_empty && !$events->have_posts()) {
         return;
     }
     $ecp = Tribe__Events__Pro__Main::instance();
     $tooltip_status = $ecp->recurring_info_tooltip_status();
     $ecp->disable_recurring_info_tooltip();
     echo $before_widget;
     do_action('tribe_events_venue_widget_before_the_title');
     echo $instance['title'] ? $args['before_title'] . $instance['title'] . $args['after_title'] : '';
     do_action('tribe_events_venue_widget_after_the_title');
     include Tribe__Events__Templates::getTemplateHierarchy('pro/widgets/venue-widget.php');
     echo $after_widget;
     if ($tooltip_status) {
         $ecp->enable_recurring_info_tooltip();
     }
     wp_reset_postdata();
 }
 public function form($instance)
 {
     $defaults = array('title' => '', 'event_ID' => null, 'event_date' => null, 'show_seconds' => true, 'complete' => 'Hooray!');
     $instance = wp_parse_args((array) $instance, $defaults);
     $limit = apply_filters('tribe_events_pro_countdown_widget_limit', 250);
     $paged = apply_filters('tribe_events_pro_countdown_widget_paged', 1);
     $events = tribe_get_events(array('eventDisplay' => 'list', 'posts_per_page' => $limit, 'paged' => $paged));
     include Tribe__Events__Pro__Main::instance()->pluginPath . 'src/admin-views/widget-admin-countdown.php';
 }
    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>&bullet;</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>&bullet;</span> <em>' . date($time_format, $start_date) . ' &ndash; ' . 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();
    }
示例#6
0
 /**
  * List view ajax handler
  *
  */
 public function ajax_response()
 {
     Tribe__Events__Query::init();
     $tribe_paged = !empty($_POST['tribe_paged']) ? intval($_POST['tribe_paged']) : 1;
     $post_status = array('publish');
     if (is_user_logged_in()) {
         $post_status[] = 'private';
     }
     $args = array('eventDisplay' => 'list', 'post_type' => Tribe__Events__Main::POSTTYPE, 'post_status' => $post_status, 'paged' => $tribe_paged);
     // check & set display
     if (isset($_POST['tribe_event_display'])) {
         if ($_POST['tribe_event_display'] == 'past') {
             $args['eventDisplay'] = 'past';
             $args['order'] = 'DESC';
         } elseif ('all' == $_POST['tribe_event_display']) {
             $args['eventDisplay'] = 'all';
         }
     }
     // check & set event category
     if (isset($_POST['tribe_event_category'])) {
         $args[Tribe__Events__Main::TAXONOMY] = $_POST['tribe_event_category'];
     }
     $args = apply_filters('tribe_events_listview_ajax_get_event_args', $args, $_POST);
     $query = tribe_get_events($args, true);
     // $hash is used to detect whether the primary arguments in the query have changed (i.e. due to a filter bar request)
     // if they have, we want to go back to page 1
     $hash = $query->query_vars;
     $hash['paged'] = null;
     $hash['start_date'] = null;
     $hash['end_date'] = null;
     $hash_str = md5(maybe_serialize($hash));
     if (!empty($_POST['hash']) && $hash_str !== $_POST['hash']) {
         $tribe_paged = 1;
         $args['paged'] = 1;
         $query = Tribe__Events__Query::getEvents($args, true);
     }
     $response = array('html' => '', 'success' => true, 'max_pages' => $query->max_num_pages, 'hash' => $hash_str, 'tribe_paged' => $tribe_paged, 'total_count' => $query->found_posts, 'view' => 'list');
     global $wp_query, $post, $paged;
     $wp_query = $query;
     if (!empty($query->posts)) {
         $post = $query->posts[0];
     }
     $paged = $tribe_paged;
     Tribe__Events__Main::instance()->displaying = apply_filters('tribe_events_listview_ajax_event_display', 'list', $args);
     if (!empty($_POST['tribe_event_display']) && $_POST['tribe_event_display'] == 'past') {
         $response['view'] = 'past';
     }
     ob_start();
     tribe_get_view('list/content');
     $response['html'] .= ob_get_clean();
     apply_filters('tribe_events_ajax_response', $response);
     header('Content-type: application/json');
     echo json_encode($response);
     die;
 }
示例#7
0
 public function widget($args, $instance)
 {
     // We need the Defaults to avoid problems on the Customizer
     $defaults = array('title' => '', 'venue_ID' => null, 'count' => 3, 'hide_if_empty' => true);
     $instance = wp_parse_args((array) $instance, $defaults);
     extract($args);
     extract($instance);
     if (empty($hide_if_empty) || 'false' === $hide_if_empty) {
         $hide_if_empty = false;
     }
     $event_args = array('post_type' => Tribe__Events__Main::POSTTYPE, 'venue' => $venue_ID, 'posts_per_page' => $count, 'eventDisplay' => 'list', 'tribe_render_context' => 'widget');
     /**
      * Filter Venue Widget tribe_get_event args
      *
      * @param array $event_args Arguments for the Venue Widget's call to tribe_get_events
      */
     $event_args = apply_filters('tribe_events_pro_venue_widget_event_query_args', $event_args);
     // Get all the upcoming events for this venue.
     $events = tribe_get_events($event_args, true);
     // If there are no events, and the user has set to hide if empty, don't display the widget.
     if ($hide_if_empty && !$events->have_posts()) {
         return;
     }
     $ecp = Tribe__Events__Pro__Main::instance();
     $tooltip_status = $ecp->recurring_info_tooltip_status();
     $ecp->disable_recurring_info_tooltip();
     echo $before_widget;
     do_action('tribe_events_venue_widget_before_the_title');
     echo $instance['title'] ? $args['before_title'] . $instance['title'] . $args['after_title'] : '';
     do_action('tribe_events_venue_widget_after_the_title');
     include Tribe__Events__Templates::getTemplateHierarchy('pro/widgets/venue-widget.php');
     echo $after_widget;
     if ($tooltip_status) {
         $ecp->enable_recurring_info_tooltip();
     }
     $jsonld_enable = isset($instance['jsonld_enable']) ? $instance['jsonld_enable'] : true;
     /**
      * Filters whether JSON LD information should be printed to the page or not for this widget type.
      *
      * @param bool $jsonld_enable Whether JSON-LD should be printed to the page or not; default `true`.
      */
     $jsonld_enable = apply_filters('tribe_events_' . $this->id_base . '_jsonld_enabled', $jsonld_enable);
     /**
      * Filters whether JSON LD information should be printed to the page for any widget type.
      *
      * @param bool $jsonld_enable Whether JSON-LD should be printed to the page or not; default `true`.
      */
     $jsonld_enable = apply_filters('tribe_events_widget_jsonld_enabled', $jsonld_enable);
     if ($jsonld_enable) {
         $this->print_jsonld_markup_for($events);
     }
     wp_reset_postdata();
 }
 /**
  * The main widget output function (called by the class's widget() function).
  *
  * @param array  $args
  * @param array  $instance
  * @param string $template_name The template name.
  * @param string $subfolder     The subfolder where the template can be found.
  * @param string $namespace     The namespace for the widget template stuff.
  * @param string $pluginPath    The pluginpath so we can locate the template stuff.
  */
 public function widget_output($args, $instance, $template_name = 'widgets/list-widget')
 {
     global $wp_query, $tribe_ecp, $post;
     $instance = wp_parse_args($instance, array('limit' => self::$limit, 'title' => ''));
     /**
      * @var $after_title
      * @var $after_widget
      * @var $before_title
      * @var $before_widget
      * @var $limit
      * @var $no_upcoming_events
      * @var $title
      */
     extract($args, EXTR_SKIP);
     extract($instance, EXTR_SKIP);
     // Temporarily unset the tribe bar params so they don't apply
     $hold_tribe_bar_args = array();
     foreach ($_REQUEST as $key => $value) {
         if ($value && strpos($key, 'tribe-bar-') === 0) {
             $hold_tribe_bar_args[$key] = $value;
             unset($_REQUEST[$key]);
         }
     }
     $title = apply_filters('widget_title', $title);
     self::$limit = absint($limit);
     if (!function_exists('tribe_get_events')) {
         return;
     }
     self::$posts = tribe_get_events(apply_filters('tribe_events_list_widget_query_args', array('eventDisplay' => 'list', 'posts_per_page' => self::$limit, 'tribe_render_context' => 'widget')));
     // If no posts, and the don't show if no posts checked, let's bail
     if (empty(self::$posts) && $no_upcoming_events) {
         return;
     }
     echo $before_widget;
     do_action('tribe_events_before_list_widget');
     if ($title) {
         do_action('tribe_events_list_widget_before_the_title');
         echo $before_title . $title . $after_title;
         do_action('tribe_events_list_widget_after_the_title');
     }
     // Include template file
     include Tribe__Events__Templates::getTemplateHierarchy($template_name);
     do_action('tribe_events_after_list_widget');
     echo $after_widget;
     wp_reset_query();
     // Reinstate the tribe bar params
     if (!empty($hold_tribe_bar_args)) {
         foreach ($hold_tribe_bar_args as $key => $value) {
             $_REQUEST[$key] = $value;
         }
     }
 }
 /**
  * Provides all of the recurring events for the provided date that have the same event parent
  *
  * @since 4.0.3
  *
  * @param int $event_id Event ID
  * @param string $date Date to fetch recurring events from
  *
  * @return string
  */
 public function get_recurring_events_for_date($event_id, $date)
 {
     if (!($event = tribe_events_get_event($event_id))) {
         return array();
     }
     $parent_id = empty($event->post_parent) ? $event->ID : $event->post_parent;
     $post_status = array('publish');
     if (is_user_logged_in()) {
         $post_status[] = 'private';
     }
     $args = array('start_date' => tribe_beginning_of_day($date), 'end_date' => tribe_end_of_day($date), 'post_status' => $post_status, 'post_parent' => $parent_id, 'tribeHideRecurrence' => false);
     $events = tribe_get_events($args);
     return $events;
 }
示例#10
0
 /**
  * The main widget output function (called by the class's widget() function).
  *
  * @param array $args
  * @param array $instance
  * @param string $template_name The template name.
  * @param string $subfolder The subfolder where the template can be found.
  * @param string $namespace The namespace for the widget template stuff.
  * @param string $pluginPath The pluginpath so we can locate the template stuff.
  */
 function widget_output($args, $instance, $template_name = 'list-widget', $subfolder = 'widgets', $namespace = '/', $pluginPath = '')
 {
     global $wp_query, $tribe_ecp, $post;
     extract($args, EXTR_SKIP);
     // The view expects all these $instance variables, which may not be set without pro
     $instance = wp_parse_args($instance, array('limit' => 5, 'title' => ''));
     extract($instance, EXTR_SKIP);
     // extracting $instance provides $title, $limit
     $title = apply_filters('widget_title', $title);
     if (!isset($category) || $category === '-1') {
         $category = 0;
     }
     if (tribe_get_option('viewOption') == 'upcoming') {
         $event_url = tribe_get_listview_link($category);
     } else {
         $event_url = tribe_get_gridview_link($category);
     }
     if (function_exists('tribe_get_events')) {
         $args = array('eventDisplay' => 'upcoming', 'posts_per_page' => $limit);
         if (!empty($category)) {
             $args['tax_query'] = array(array('taxonomy' => TribeEvents::TAXONOMY, 'terms' => $category, 'field' => 'ID', 'include_children' => false));
         }
         $posts = tribe_get_events($args);
     }
     // if no posts, and the don't show if no posts checked, let's bail
     if (!$posts && $no_upcoming_events) {
         return;
     }
     /* Before widget (defined by themes). */
     echo $before_widget;
     /* Title of widget (before and after defined by themes). */
     echo $title ? $before_title . $title . $after_title : '';
     if ($posts) {
         /* Display list of events. */
         echo '<ol class="hfeed vcalendar">';
         foreach ($posts as $post) {
             setup_postdata($post);
             include TribeEventsTemplates::getTemplateHierarchy('widgets/list-widget.php');
         }
         echo "</ol><!-- .hfeed -->";
         /* Display link to all events */
         echo '<p class="tribe-events-widget-link"><a href="' . $event_url . '" rel="bookmark">' . __('View All Events', 'tribe-events-calendar') . '</a></p>';
     } else {
         echo '<p>' . __('There are no upcoming events at this time.', 'tribe-events-calendar') . '</p>';
     }
     /* After widget (defined by themes). */
     echo $after_widget;
     wp_reset_query();
 }
 public static function shortcode($atts, $content = null, $code)
 {
     extract(shortcode_atts(array('layout' => 'single', 'style' => 'light', 'count' => 1, 'ongoing' => '', 'lead_text' => '', 'view_all_text' => '', 'view_all_link' => '', 'read_more_text' => '', 'cat' => ''), $atts));
     if (!function_exists('tribe_get_events')) {
         return '';
     }
     $query = array('posts_per_page' => $count, 'order' => 'ASC', 'start_date' => current_time('Y-m-d H:i:s') . ' ' . get_option('timezone_string'));
     $cat = empty($cat) ? array() : (is_array($cat) ? $cat : explode(',', $cat));
     if (!empty($cat) && !empty($cat[0])) {
         $query['tax_query'] = array(array('taxonomy' => 'tribe_events_cat', 'field' => 'slug', 'terms' => $cat));
     }
     $events = tribe_get_events($query);
     ob_start();
     $layout_file = explode('-', $layout);
     include locate_template("templates/shortcodes/events/{$layout_file[0]}.php");
     return ob_get_clean();
 }
示例#12
0
function ckhp_get_tribe_list($atts)
{
    if (!function_exists('tribe_get_events')) {
        return;
    }
    global $wp_query, $tribe_ecp, $post;
    $output = '';
    $ckhp_event_tax = '';
    extract(shortcode_atts(array('cat' => '', 'number' => 5, 'class' => '', 'error' => 'y'), $atts, 'ckhp-tribe-events'), EXTR_PREFIX_ALL, 'ckhp');
    $class = $atts['class'];
    if ($ckhp_cat) {
        $ckhp_event_tax = array(array('taxonomy' => 'tribe_events_cat', 'field' => 'slug', 'terms' => $ckhp_cat));
    }
    $posts = tribe_get_events(apply_filters('tribe_events_list_widget_query_args', array('eventDisplay' => 'upcoming', 'posts_per_page' => $ckhp_number, 'tax_query' => $ckhp_event_tax)));
    if (!isset($no_upcoming_events)) {
        $no_upcoming_events = 0;
    }
    if ($posts && !$no_upcoming_events) {
        if ($posts && !$no_upcoming_events) {
            $output .= '<div class="event-calendar ' . $class . '">';
            foreach ($posts as $post) {
                setup_postdata($post);
                $output .= '<a href="' . tribe_get_event_link() . '" rel="bookmark">';
                $output .= '<div class="event-post">';
                $output .= '<div class="event-date">';
                $output .= '<time>' . sp_get_start_date($postId = null, $showtime = true, $dateFormat = 'M') . '<span>' . sp_get_start_date($postId = null, $showtime = true, $dateFormat = 'd') . '</span></time>';
                $output .= '</div>';
                $output .= '<div class="event-details">';
                $output .= '<p>' . sp_get_start_date($postId = null, $showtime = true, $dateFormat = 'l') . ' ' . sp_get_start_date($postId = null, $showtime = true, $dateFormat = 'g:i a') . '</p>';
                $output .= '<h4 class="media-heading">' . '<a href="' . tribe_get_event_link() . '" rel="bookmark">' . get_the_title() . '</a>' . '</h4>';
                $output .= '</div>';
                $output .= '</div>';
                $output .= '</a>';
            }
            $output .= '</div><!-- .hfeed -->';
            $output .= '<p class="tribe-events-widget-link"><a class="btn btn-primary btn-sm" href="' . tribe_get_events_link() . '" rel="bookmark">' . translate('View All Events', 'tribe-events-calendar') . '</a></p>';
        }
    } else {
        //No Events were Found
        $output .= $ckhp_error == 'y' ? '<p>' . translate('There are no upcoming events at this time.', 'tribe-events-calendar') . '</p>' : '';
    }
    // endif
    wp_reset_query();
    return $output;
}
 /**
  * Returns the link to export the whole recurring  series in iCal format.
  *
  * @param int|WP_Pos|null $event_id A event post object, an event post ID or null to use the globally defined post object.
  *
  * @return string The absolute URL to export the whole recurring series in iCal format.
  */
 function tribe_get_recurrence_ical_link($event_id = null)
 {
     $event_id = Tribe__Events__Main::postIdHelper($event_id);
     if (empty($event_id) || !tribe_is_event($event_id)) {
         return '';
     }
     $event = get_post($event_id);
     $parent_id = empty($event->post_parent) ? $event_id : $event->post_parent;
     $url = get_permalink($parent_id);
     $url_vars = array('ical' => '1');
     if (tribe_is_recurring_event($parent_id)) {
         $child_events_ids = tribe_get_events(array('fields' => 'ids', 'post_parent' => $parent_id));
         $event_ids = array_merge(array($parent_id), $child_events_ids);
         $url_vars['event_ids'] = implode(',', $event_ids);
     }
     $url = add_query_arg($url_vars, $url);
     return apply_filters('tribe_get_recurrence_ical_link', $url, $event_id);
 }
 function widget($args, $instance)
 {
     extract($args);
     extract($instance);
     if (empty($hide_if_empty)) {
         $hide_if_empty = false;
     }
     // Get all the upcoming events for this venue.
     $events = tribe_get_events(array('post_type' => TribeEvents::POSTTYPE, 'meta_key' => '_EventVenueID', 'meta_value' => $venue_ID, 'posts_per_page' => $count, 'eventDisplay' => 'upcoming'));
     // If there are no events, and the user has set to hide if empty, don't display the widget.
     if ($hide_if_empty && empty($events)) {
         return;
     }
     echo $before_widget;
     $title = $before_title . apply_filters('widget_title', $title) . $after_title;
     include TribeEventsTemplates::getTemplateHierarchy('widgets/venue-widget.php');
     echo $after_widget;
 }
示例#15
0
 function widget_output($args, $instance, $template_name = 'events-list-load-widget-display')
 {
     global $wp_query, $tribe_ecp, $post;
     extract($args, EXTR_SKIP);
     extract($instance, EXTR_SKIP);
     // extracting $instance provides $title, $limit
     $title = apply_filters('widget_title', $title);
     if (!isset($category)) {
         $category = null;
     }
     if (tribe_get_option('viewOption') == 'upcoming') {
         $event_url = tribe_get_listview_link($category != -1 ? intval($category) : null);
     } else {
         $event_url = tribe_get_gridview_link($category != -1 ? intval($category) : null);
     }
     if (function_exists('tribe_get_events')) {
         $posts = tribe_get_events('eventDisplay=upcoming&posts_per_page=' . $limit . '&eventCat=' . $category);
         $template = TribeEventsTemplates::getTemplateHierarchy($template_name);
     }
     // if no posts, and the don't show if no posts checked, let's bail
     if (!$posts && $no_upcoming_events) {
         return;
     }
     /* Before widget (defined by themes). */
     echo $before_widget;
     /* Title of widget (before and after defined by themes). */
     echo $title ? $before_title . $title . $after_title : '';
     if ($posts) {
         /* Display list of events. */
         echo "<ul class='upcoming'>";
         foreach ($posts as $post) {
             setup_postdata($post);
             include $template;
         }
         echo "</ul>";
         /* Display link to all events */
         echo '<div class="dig-in"><a href="' . $event_url . '">' . __('View All Events', 'tribe-events-calendar') . '</a></div>';
     } else {
         _e('There are no upcoming events at this time.', 'tribe-events-calendar');
     }
     /* After widget (defined by themes). */
     echo $after_widget;
     wp_reset_query();
 }
示例#16
0
 function widget($args, $instance)
 {
     global $wp_query, $post;
     $old_post = $post;
     extract($args, EXTR_SKIP);
     extract($instance, EXTR_SKIP);
     // extracting $instance provides $title, $limit, $no_upcoming_events, $start, $end, $venue, $address, $city, $state, $province'], $zip, $country, $phone , $cost
     $title = apply_filters('widget_title', $title);
     if (tribe_get_option('viewOption') == 'upcoming') {
         $event_url = tribe_get_listview_link();
     } else {
         $event_url = tribe_get_gridview_link();
     }
     if (function_exists('tribe_get_events')) {
         $posts = tribe_get_events('eventDisplay=upcoming&numResults=1&eventCat=' . $category);
         $template = TribeEventsTemplates::getTemplateHierarchy('widget-featured-display');
     }
     // if no posts, and the don't show if no posts checked, let's bail
     if (!$posts && isset($no_upcoming_events) && $no_upcoming_events) {
         return;
     }
     /* Before widget (defined by themes). */
     echo $before_widget;
     /* Title of widget (before and after defined by themes). */
     echo $title ? $before_title . $title . $after_title : '';
     if ($posts) {
         /* Display list of events. */
         foreach ($posts as $post) {
             setup_postdata($post);
             include $template;
         }
     } else {
         echo "<p>";
         _e('There are no upcoming events at this time.', 'tribe-events-calendar-pro');
         echo "</p>";
     }
     /* After widget (defined by themes). */
     echo $after_widget;
     $post = $old_post;
 }
示例#17
0
function get_services()
{
    $output = '';
    $output .= '<div class="services-content"><ul>';
    $events = tribe_get_events(array('order' => 'DESC'));
    foreach ($events as $key => $value) {
        $age = get_post_custom_values("age", $value->ID);
        if ($age[0]) {
            $age = ", " . $age[0];
        } else {
            $age = "";
        }
        $title = $value->post_title;
        $date = $value->EventStartDate;
        $date = date("M d, Y", strtotime($value->EventStartDate));
        $event_url = get_permalink($value->ID);
        //var_dump($value);
        $output .= '<li class="event-elemnet"><a href="' . $event_url . '" class="event-element-title">' . $title . $age . '</a><span class="event-element-date"> ' . $date . '</span></li>';
    }
    $output .= '</ul></div>';
    return $output;
}
示例#18
0
 /**
  * Provides all of the recurring events for the provided date that have the same event parent
  *
  * @since 4.0.3
  *
  * @param int $event_id Event ID
  * @param string $date Date to fetch recurring events from
  *
  * @return string
  */
 public function get_recurring_events_for_date($event_id, $date)
 {
     if (!($event = tribe_events_get_event($event_id))) {
         return array();
     }
     $parent_id = empty($event->post_parent) ? $event->ID : $event->post_parent;
     $post_status = array('publish');
     if (is_user_logged_in()) {
         $post_status[] = 'private';
     }
     $args = array('start_date' => tribe_beginning_of_day($date), 'end_date' => tribe_end_of_day($date), 'post_status' => $post_status, 'tribeHideRecurrence' => false);
     // we want event times regardless of whether or not the event is a parent or a child
     // recurring event. We have to fetch those slightly differently depending on which
     // it is
     if (empty($event->post_parent)) {
         // we're looking at the master event, so grab the info via the ID
         $args['p'] = $parent_id;
     } else {
         // we're looking at a child event, so grab the info via post_parent
         $args['post_parent'] = $parent_id;
     }
     $events = tribe_get_events($args);
     return $events;
 }
function tribe_get_related_workshop_posts($count = 3, $post = false)
{
    $postid = get_the_ID();
    // Override: replace with custom  version of tribe_get_related_posts()
    $posts = tribe_get_events(array('post_status' => 'publish', 'posts_per_page' => $count, 'meta_query' => array(array('key' => 'WORKSHOP-PARENT-EVENT-ID', 'value' => $postid))));
    return apply_filters('tribe_get_related_workshop_posts', $posts);
}
示例#20
0
 /**
  * Gets all events in the current month, matching those presented in month view
  * by default (and therefore potentially including some events from the tail end
  * of the previous month and start of the following month).
  *
  * We build a fresh 'custom'-type query here rather than taking advantage of the
  * main query since page spoofing can render the actual query and results
  * inaccessible (and it cannot be recovered via a query reset).
  *
  * @return array events in the month
  */
 private static function get_month_view_events()
 {
     global $wp_query;
     $event_date = $wp_query->get('eventDate');
     $month = empty($event_date) ? tribe_get_month_view_date() : $wp_query->get('eventDate');
     $args = array('eventDisplay' => 'custom', 'start_date' => Tribe__Events__Template__Month::calculate_first_cell_date($month), 'end_date' => Tribe__Events__Template__Month::calculate_final_cell_date($month), 'posts_per_page' => -1, 'hide_upcoming' => true);
     /**
      * Provides an opportunity to modify the query args used to build a list of events
      * to export from month view.
      *
      * This could be useful where its desirable to limit the exported data set to only
      * those events taking place in the specific month being viewed (rather than an exact
      * match of the events shown in month view itself, which may include events from
      * adjacent months).
      *
      * @var array  $args
      * @var string $month
      */
     $args = (array) apply_filters('tribe_ical_feed_month_view_query_args', $args, $month);
     return tribe_get_events($args);
 }
示例#21
0
 /**
  * Get a "previous/next post" link for events. Ordered by start date instead of ID.
  *
  * @param WP_Post $post The post/event.
  * @param string  $mode Either 'next' or 'previous'.
  * @param mixed   $anchor
  *
  * @return string The link (with <a> tags).
  */
 public function get_event_link($post, $mode = 'next', $anchor = false)
 {
     global $wpdb;
     $link = '';
     if ('previous' === $mode) {
         $order = 'DESC';
         $direction = '<';
     } else {
         $order = 'ASC';
         $direction = '>';
         $mode = 'next';
     }
     $args = array('post__not_in' => array($post->ID), 'order' => $order, 'orderby' => "TIMESTAMP( {$wpdb->postmeta}.meta_value ) ID", 'posts_per_page' => 1, 'meta_query' => array(array('key' => '_EventStartDate', 'value' => $post->EventStartDate, 'type' => 'DATETIME', 'compare' => $direction), array('key' => '_EventHideFromUpcoming', 'compare' => 'NOT EXISTS'), 'relation' => 'AND'));
     /**
      * Allows the query arguments used when retrieving the next/previous event link
      * to be modified.
      *
      * @var array   $args
      * @var WP_Post $post
      * @var boolean $anchor
      */
     $args = (array) apply_filters("tribe_events_get_{$mode}_event_link", $args, $post, $anchor);
     $results = tribe_get_events($args);
     // If we successfully located the next/prev event, we should have precisely one element in $results
     if (1 === count($results)) {
         $event = current($results);
         if (!$anchor) {
             $anchor = apply_filters('the_title', $event->post_title);
         } elseif (strpos($anchor, '%title%') !== false) {
             // get the nicely filtered post title
             $title = apply_filters('the_title', $event->post_title, $event->ID);
             // escape special characters used in the second parameter of preg_replace
             $title = str_replace(array('\\', '$'), array('\\\\', '\\$'), $title);
             $anchor = preg_replace('|%title%|', $title, $anchor);
         }
         $link = '<a href="' . esc_url(tribe_get_event_link($event)) . '">' . $anchor . '</a>';
     }
     /**
      * Affords an opportunity to modify the event link (typically for the next or previous
      * event in relation to $post).
      *
      * @var string  $link
      * @var WP_Post $post
      * @var string  $mode (typically "previous" or "next")
      * @var string  $anchor
      */
     return apply_filters('tribe_events_get_event_link', $link, $post, $mode, $anchor);
 }
示例#22
0
	
	<div class="grid-4">
		<div class="quicklinks">
			<h3>Quick Links</h3>
			<?php 
the_field('quick_links');
?>
		</div>
	</div>
	
	<div class="grid-4">
		<h3>Events</h3>
		<ul class="features_events-list">
		<?php 
global $post;
$all_events = tribe_get_events(array('eventDisplay' => 'upcoming', 'posts_per_page' => 10));
foreach ($all_events as $post) {
    setup_postdata($post);
    ?>
			<li>
				<a href="<?php 
    the_permalink();
    ?>
"><?php 
    the_title();
    ?>
</a>
				<p><?php 
    echo tribe_get_start_date($post->ID, true, 'M j, Y');
    ?>
</p>
示例#23
0
文件: table-mini.php 项目: xdividr/wi
if (!defined('ABSPATH')) {
    die('-1');
}
$tribe_ecp = TribeEvents::instance();
global $wp_query;
$old_date = null;
if (!defined("DOING_AJAX") || !DOING_AJAX) {
    $current_date = date_i18n(TribeDateUtils::DBYEARMONTHTIMEFORMAT) . "-01";
    if (isset($wp_query->query_vars['eventDate'])) {
        $old_date = $wp_query->query_vars['eventDate'];
        $wp_query->query_vars['eventDate'] = $current_date;
    }
} else {
    $current_date = $tribe_ecp->date;
}
$eventPosts = tribe_get_events(array('eventDisplay' => 'month'));
if (!$current_date) {
    $current_date = $tribe_ecp->date;
}
$daysInMonth = isset($date) ? date("t", $date) : date("t");
$startOfWeek = get_option('start_of_week', 0);
list($year, $month) = explode('-', $current_date);
$date = mktime(12, 0, 0, $month, 1, $year);
// 1st day of month as unix stamp
$rawOffset = date("w", $date) - $startOfWeek;
$offset = $rawOffset < 0 ? $rawOffset + 7 : $rawOffset;
// month begins on day x
$rows = 1;
$monthView = tribe_sort_by_month($eventPosts, $current_date);
// the div tribe-events-widget-nav controls ajax navigation for the calendar widget. Modify with care and do not remove any class names or elements inside that element if you wish to retain ajax functionality.
?>
示例#24
0
"><?php 
            the_title();
            ?>
</a></h4>
					<?php 
            the_excerpt();
            ?>
				</article>
				<?php 
        }
        //endforeach
    }
    wp_reset_query();
    // show past events
    global $post;
    $get_posts = tribe_get_events(array('posts_per_page' => -1, 'eventDisplay' => 'past', 'tax_query' => array(array('taxonomy' => 'tribe_events_cat', 'field' => 'slug', 'terms' => 'student'))));
    if ($get_posts) {
        // its not filtering, filter for only past
        if (!tribe_is_showing_all() && strtotime(tribe_get_end_date($post, false, 'Y-m-d G:i') . $gmt_offset) <= time()) {
            ?>
        <h4>Past Student Events</h4>
	<?php 
        }
        foreach ($get_posts as $post) {
            setup_postdata($post);
            // its not filtering, filter for only past
            if (!tribe_is_showing_all() && strtotime(tribe_get_end_date($post, false, 'Y-m-d G:i') . $gmt_offset) <= time()) {
                ?>
        <article <?php 
                post_class();
                ?>
示例#25
0
 /**
  * Indicates if this instance already seems to be in existence.
  *
  * @return bool
  */
 public function already_exists()
 {
     $parent = get_post($this->parent_id);
     $possible_matches = tribe_get_events(array('post_parent' => $parent->ID, 'name' => $parent->post_name . '-' . $this->start_date->format('Y-m-d')));
     foreach ($possible_matches as $existing_post) {
         if ($this->duration == $existing_post->_EventDuration) {
             return true;
         }
     }
     return false;
 }
示例#26
0
文件: Main.php 项目: TakenCdosG/chefs
 /**
  * Get the prev/next post for a given event. Ordered by start date instead of ID.
  *
  * @param WP_Post $post The post/event.
  * @param string  $mode Either 'next' or 'previous'.
  *
  * @return null|WP_Post
  */
 public function get_closest_event($post, $mode = 'next')
 {
     global $wpdb;
     if ('previous' === $mode) {
         $order = 'DESC';
         $direction = '<';
     } else {
         $order = 'ASC';
         $direction = '>';
         $mode = 'next';
     }
     $args = array('post__not_in' => array($post->ID), 'order' => $order, 'orderby' => "TIMESTAMP( {$wpdb->postmeta}.meta_value ) ID", 'posts_per_page' => 1, 'meta_query' => array(array('key' => '_EventStartDate', 'value' => $post->EventStartDate, 'type' => 'DATETIME', 'compare' => $direction), array('key' => '_EventHideFromUpcoming', 'compare' => 'NOT EXISTS'), 'relation' => 'AND'));
     /**
      * Allows the query arguments used when retrieving the next/previous event link
      * to be modified.
      *
      * @var array   $args
      * @var WP_Post $post
      */
     $args = (array) apply_filters("tribe_events_get_{$mode}_event_link", $args, $post);
     add_filter('posts_where', array($this, 'get_closest_event_where'));
     $results = tribe_get_events($args);
     remove_filter('posts_where', array($this, 'get_closest_event_where'));
     $event = null;
     // If we successfully located the next/prev event, we should have precisely one element in $results
     if (1 === count($results)) {
         $event = current($results);
     }
     /**
      * Affords an opportunity to modify the event used to generate the event link (typically for
      * the next or previous event in relation to $post).
      *
      * @var WP_Post $post
      * @var string  $mode (typically "previous" or "next")
      */
     return apply_filters('tribe_events_get_closest_event', $event, $post, $mode);
 }
示例#27
0
 /**
  * Are there any events next (in the future) to the current events in $wp_query
  *
  * @return bool
  */
 function tribe_has_next_event()
 {
     global $wp_query;
     $has_next = false;
     $past = tribe_is_past();
     $upcoming = !$past;
     $cur_page = (int) $wp_query->get('paged');
     $max_pages = (int) $wp_query->max_num_pages;
     $page_1 = 0 === $cur_page || 1 === $cur_page;
     // if we are on page "0" or 1, consider it page 1. Otherwise, consider it the current page. This
     // is used for determining which navigation items to show
     $effective_page = $page_1 ? 1 : $cur_page;
     // Simple tests based on pagination properties
     if ($upcoming && $effective_page < $max_pages) {
         $has_next = true;
     }
     if ($past && $effective_page > 1) {
         $has_next = true;
     }
     // Test for future events (on first page of the past events list only)
     if ($past && $page_1 && !$has_next) {
         // Inherit args from the main query so that taxonomy conditions etc are respected
         $args = (array) $wp_query->query;
         // Make some efficiency savings
         $args['no_paging'] = true;
         $args['no_found_rows'] = true;
         $args['posts_per_page'] = 1;
         $next_event = tribe_get_events($args);
         $has_next = count($next_event) >= 1;
     }
     return apply_filters('tribe_has_next_event', $has_next);
 }
 /**
  * Month View Ajax Handler
  *
  */
 public function ajax_response()
 {
     if (isset($_POST['eventDate']) && $_POST['eventDate']) {
         Tribe__Events__Query::init();
         Tribe__Events__Main::instance()->displaying = 'month';
         global $wp_query;
         $wp_query = tribe_get_events($this->args, true);
         ob_start();
         tribe_get_view('month/content');
         $response = array('html' => ob_get_clean(), 'success' => true, 'view' => 'month');
         apply_filters('tribe_events_ajax_response', $response);
         header('Content-type: application/json');
         echo json_encode($response);
         die;
     }
 }
示例#29
0
            }
        } else {
            // no posts found
            echo 'No posts found';
        }
        /* Restore original Post Data */
        wp_reset_postdata();
        ?>
 
				</div>
				<div class="col-md-4">
					<div class="outline news">
						
	<?php 
        $now = date("Y-m-d G:i:s");
        $proj_events = tribe_get_events(array('start_date' => date('Y-m-d H:i:s', strtotime('+1 day')), 'end_date' => date('Y-m-d H:i:s', strtotime('+1 week')), 'eventDisplay' => 'custom', 'posts_per_page' => -1, 'tax_query' => array(array('taxonomy' => 'tribe_events_cat', 'field' => 'slug', 'terms' => 'long-term', 'operator' => 'NOT IN'))), true);
        ?>
	<?php 
        if ($proj_events->have_posts()) {
            $countposts = $proj_events->found_posts;
            ?>
	<div class="row">	
		<h2 class="this-week">THIS WEEK</h2>
		<?php 
            while ($proj_events->have_posts()) {
                $proj_events->the_post();
                ?>
		<div class="upcoming">
			<div class="front-card small">
			<a href="<?php 
                the_permalink();
    }
  <?php endforeach; ?>
</style>

<!-- Events Categories  -->
<ul class="events-categories-list">
  <?php foreach( $cats as $item ): ?>
    <?php $term_color = get_term_meta( $item->term_id , '_events_category_color', true ) ?>
    <li class="item"><i class="ic-block" style="background-color: <?php echo $term_color; ?>"></i><?php echo $item->name; ?></li>
  <?php endforeach; ?>
</ul>

<?php 
  // Retrieve the next 3 upcoming events
  $events = tribe_get_events( array(
    'posts_per_page' => 4,
    'orderby' => 'menu_order',
  ) );
?>

<ul class="latest-events-list">
<?php foreach( $events as $event ): ?>

  <li class="item col-xs-6 col-sm-12">
    <a href="#" class="item-link" data-event_id="<?php echo $event->ID; ?>">

      <?php $src = wp_get_attachment_image_src( get_post_thumbnail_id( $event->ID ), 'event-medium' ); ?>
      <img class="bg-image" src="<?php echo $src[0]; ?>" alt="">
      <span class="bg-image-mask"></span>
      <div class="item-content">
        <div class="date">
          <span class="num"><?php echo tribe_get_start_date( $event, false, 'd' ); ?></span>