当前位置: 首页>>代码示例>>PHP>>正文


PHP tribe_get_events函数代码示例

本文整理汇总了PHP中tribe_get_events函数的典型用法代码示例。如果您正苦于以下问题:PHP tribe_get_events函数的具体用法?PHP tribe_get_events怎么用?PHP tribe_get_events使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了tribe_get_events函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: form

 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';
 }
开发者ID:donwea,项目名称:nhap.org,代码行数:7,代码来源:widget-countdown.class.php

示例2: widget

 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();
 }
开发者ID:donwea,项目名称:nhap.org,代码行数:27,代码来源:widget-venue.class.php

示例3: widget

 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();
 }
开发者ID:TravisSperry,项目名称:mpa_website,代码行数:34,代码来源:Venue_Widget.php

示例4: form

 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';
 }
开发者ID:simple-beck,项目名称:project-gc,代码行数:9,代码来源:Countdown_Widget.php

示例5: front_end

    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();
    }
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:55,代码来源:upcoming-events.php

示例6: ajax_response

 /**
  * 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;
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:59,代码来源:List.php

示例7: widget

 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();
 }
开发者ID:TakenCdosG,项目名称:chefs,代码行数:53,代码来源:Venue_Widget.php

示例8: widget_output

 /**
  * 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;
         }
     }
 }
开发者ID:reubenbrown13,项目名称:the-events-calendar,代码行数:62,代码来源:List_Widget.php

示例9: get_recurring_events_for_date

 /**
  * 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;
 }
开发者ID:acutedeveloper,项目名称:havering-intranet-development,代码行数:24,代码来源:Single_Event_Overrides.php

示例10: widget_output

 /**
  * 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();
 }
开发者ID:paarthd,项目名称:gslvpa,代码行数:59,代码来源:widget-list.class.php

示例11: shortcode

 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();
 }
开发者ID:petrfaitl,项目名称:wordpress-event-theme,代码行数:17,代码来源:wpv_tribe_events.php

示例12: ckhp_get_tribe_list

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;
}
开发者ID:breonwilliams,项目名称:boot-plus,代码行数:45,代码来源:recent-events.php

示例13: tribe_get_recurrence_ical_link

 /**
  * 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);
 }
开发者ID:acutedeveloper,项目名称:havering-intranet-development,代码行数:25,代码来源:ical.php

示例14: widget

 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;
 }
开发者ID:TyRichards,项目名称:river_of_life,代码行数:18,代码来源:widget-venue.class.php

示例15: widget_output

 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();
 }
开发者ID:mpaskew,项目名称:isc-dev,代码行数:44,代码来源:widget-list.class.php


注:本文中的tribe_get_events函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。