/** * 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(); }
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(); }
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; }
/** * Set up the calendar view in the view selector in the tribe events bar. * * @param array $views The current views array. * * @return array The modified views array. */ public function setup_gridview_in_bar($views) { $views[] = array('displaying' => 'month', 'event_bar_hook' => 'tribe_events_month_before_template', 'anchor' => __('Month', 'the-events-calendar'), 'url' => tribe_get_gridview_link()); return $views; }
/** * Prints out data attributes used in the template header tags * * @category Events * @param string|null $current_view * * @return void * @todo move to template classes **/ function tribe_events_the_header_attributes($current_view = null) { $attrs = array(); $current_view = !empty($current_view) ? $current_view : basename(tribe_get_current_template()); $attrs['data-title'] = wp_title('|', false, 'right'); switch ($current_view) { case 'month.php': $attrs['data-view'] = 'month'; $attrs['data-date'] = date('Y-m', strtotime(tribe_get_month_view_date())); $attrs['data-baseurl'] = tribe_get_gridview_link(false); break; case 'day.php': $attrs['data-startofweek'] = get_option('start_of_week'); break; case 'list.php': $attrs['data-startofweek'] = get_option('start_of_week'); $attrs['data-view'] = 'list'; if (tribe_is_upcoming()) { $attrs['data-baseurl'] = tribe_get_listview_link(false); } elseif (tribe_is_past()) { $attrs['data-view'] = 'past'; $attrs['data-baseurl'] = tribe_get_listview_past_link(false); } break; } if (has_filter('tribe_events_mobile_breakpoint')) { $attrs['data-mobilebreak'] = tribe_get_mobile_breakpoint(); } $attrs = apply_filters('tribe_events_header_attributes', $attrs, $current_view); foreach ($attrs as $attr => $value) { echo " {$attr}=" . '"' . esc_attr($value) . '"'; } }
echo esc_url(admin_url('images/wpspin_light.gif')); ?> " class="ajax-loading" id="ajax-loading" alt="" style='display: none'/> </span> </span> <span class='tribe-events-calendar-buttons'> <a class='tribe-events-button-off' href='<?php echo tribe_get_listview_link(); ?> '><?php _e('Event List', 'tribe-events-calendar'); ?> </a> <a class='tribe-events-button-on' href='<?php echo tribe_get_gridview_link(); ?> '><?php _e('Calendar', 'tribe-events-calendar'); ?> </a> </span> </div><!-- tribe-events-calendar-header --> <?php tribe_calendar_grid(); // See the views/table.php template for customization ?> <?php if (function_exists('tribe_get_ical_link')) { ?> <a title="<?php
/** * Prints out data attributes used in the template header tags * * @param string|null $current_view * @return void * @since 3.0 **/ function tribe_events_the_header_attributes($current_view = null) { $attrs = array(); $current_view = !empty($current_view) ? $current_view : basename(tribe_get_current_template()); $attrs['data-title'] = wp_title('»', false); switch ($current_view) { case 'month.php': $attrs['data-view'] = 'month'; $attrs['data-date'] = date('Y-m', strtotime(tribe_get_month_view_date())); $attrs['data-baseurl'] = tribe_get_gridview_link(false); break; case 'list.php': $attrs['data-view'] = 'list'; if (tribe_is_upcoming()) { $attrs['data-baseurl'] = tribe_get_listview_link(false); } elseif (tribe_is_past()) { $attrs['data-view'] = 'past'; $attrs['data-baseurl'] = tribe_get_listview_past_link(false); } break; } $attrs = apply_filters('tribe_events_header_attributes', $attrs, $current_view); foreach ($attrs as $attr => $value) { echo " {$attr}=" . '"' . $value . '"'; } }
/** * @deprecated */ function sp_get_gridview_link($term = null) { _deprecated_function(__FUNCTION__, '2.0', 'tribe_get_gridview_link()'); return tribe_get_gridview_link($term); }
function axiom_tribe_events_get_period_links($links, $page, $delimiter = '') { if (!empty($links)) { return $links; } global $post; if ($page == 'tribe_day' && is_object($post)) { $links = '<a class="breadcrumbs_item cat_parent" href="' . tribe_get_gridview_link(false) . '">' . date_i18n(tribe_get_option('monthAndYearFormat', 'F Y'), strtotime(tribe_get_month_view_date())) . '</a>'; } return $links; }
function showBreadcrumbs($args = array()) { global $wp_query, $post; $args = array_merge(array('home' => __('Home', 'themerex'), 'home_url' => '', 'show_all_filters' => true, 'show_all_posts' => true, 'truncate_title' => 50, 'truncate_add' => '...', 'delimiter' => ' / ', 'max_levels' => get_theme_option('breadcrumbs_max_level'), 'echo' => true), is_array($args) ? $args : array('home' => $args)); $rez = ''; $rez2 = ''; $rez_all = ''; $rez_level = ''; $type = getBlogType(); $title = getShortString(getBlogTitle(), $args['truncate_title'], $args['truncate_add']); $cat = ''; $parentTax = ''; $level = 0; if ($args['max_levels'] <= 0) { $args['max_levels'] = 999; } $args['delimiter'] = '<span class="breadcrumbs_delimiter">' . $args['delimiter'] . '</span>'; if (!in_array($type, array('home', 'frontpage'))) { $need_reset = true; $parent = 0; $post_id = 0; if ($type == 'page' || $type == 'attachment') { $pageParentID = isset($wp_query->post->post_parent) ? $wp_query->post->post_parent : 0; $post_id = $type == 'page' ? isset($wp_query->post->ID) ? $wp_query->post->ID : 0 : $pageParentID; while ($pageParentID > 0) { $pageParent = get_post($pageParentID); $level++; if ($level > $args['max_levels']) { $rez_level = '...'; } else { $rez2 = '<a class="cat_post" href="' . get_permalink($pageParent->ID) . '">' . getShortString($pageParent->post_title, $args['truncate_title'], $args['truncate_add']) . '</a>' . (!empty($rez2) ? $args['delimiter'] : '') . $rez2; } if (($pageParentID = $pageParent->post_parent) > 0) { $post_id = $pageParentID; } } } else { if ($type == 'single') { $post_id = isset($wp_query->post->ID) ? $wp_query->post->ID : 0; } } $depth = 0; $ex_cats = explode(',', get_theme_option('exclude_cats')); $taxonomy = themerex_strpos($type, 'woocommerce') !== false ? array('product_cat') : (themerex_strpos($type, 'tribe') !== false ? array('tribe_events_cat') : array('category')); do { if ($depth++ == 0) { if (in_array($type, array('single', 'attachment', 'woocommerce_product', 'tribe_event'))) { if (!in_array($type, array('woocommerce_product', 'tribe_event')) && $args['show_all_filters']) { $post_format = get_post_format($post_id); if (($tpl_id = getTemplatePageId('only-' . $post_format)) > 0) { $level++; if ($level > $args['max_levels']) { $rez_level = '...'; } else { $rez_all .= (!empty($rez_all) ? $args['delimiter'] : '') . '<a class="all" href="' . get_permalink($tpl_id) . '">' . sprintf(__('All %s', 'themerex'), getPostFormatName($post_format, false)) . '</a>'; } } } $cats = getCategoriesByPostId($post_id, $taxonomy); $cat = $cats ? $cats[0] : false; if ($cat) { if (!in_array($cat['term_id'], $ex_cats)) { $cat_link = get_term_link($cat['slug'], $cat['taxonomy']); $level++; if ($level > $args['max_levels']) { $rez_level = '...'; } else { $rez2 = '<a class="cat_post" href="' . $cat_link . '">' . getShortString($cat['name'], $args['truncate_title'], $args['truncate_add']) . '</a>' . (!empty($rez2) ? $args['delimiter'] : '') . $rez2; } } } else { $post_type = get_post_type($post_id); $parentTax = 'category' . ($post_type == 'post' ? '' : '_' . $post_type); } } else { if ($type == 'category') { $cat = get_term_by('id', get_query_var('cat'), 'category', ARRAY_A); } else { if (themerex_strpos($type, 'woocommerce') !== false) { if (is_product_category()) { $cat = get_term_by('slug', get_query_var('product_cat'), 'product_cat', ARRAY_A); } } else { if (themerex_strpos($type, 'tribe') !== false) { if (tribe_is_event_category()) { $cat = get_term_by('slug', get_query_var('tribe_events_cat'), 'tribe_events_cat', ARRAY_A); } } } } } if ($cat) { $parent = $cat['parent']; $parentTax = $cat['taxonomy']; } } if ($parent) { $cat = get_term_by('id', $parent, $parentTax, ARRAY_A); if ($cat) { if (!in_array($cat['term_id'], $ex_cats)) { $cat_link = get_term_link($cat['slug'], $cat['taxonomy']); $level++; if ($level > $args['max_levels']) { $rez_level = '...'; } else { $rez2 = '<a class="cat_parent" href="' . $cat_link . '">' . getShortString($cat['name'], $args['truncate_title'], $args['truncate_add']) . '</a>' . (!empty($rez2) ? $args['delimiter'] : '') . $rez2; } } $parent = $cat['parent']; } } } while ($parent); if (themerex_strpos($type, 'woocommerce') !== false && ($shop_id = get_option('woocommerce_shop_page_id')) > 0 && !in_array(themerex_strtolower($title), array(themerex_strtolower($shop_title = getPostTitle($shop_id))))) { $rez_all = '<a class="all" href="' . get_permalink($shop_id) . '">' . $shop_title . '</a>' . (!empty($rez_all) ? $args['delimiter'] : '') . $rez_all; } if (themerex_strpos($type, 'tribe') !== false && !in_array(themerex_strtolower($title), array(__('All Events', 'themerex'), __('Tribe Events', 'themerex')))) { $rez_all = '<a class="all" href="' . tribe_get_events_link() . '">' . __('All Events', 'themerex') . '</a>' . (!empty($rez_all) ? $args['delimiter'] : '') . $rez_all; } if ($args['show_all_posts'] && !in_array(themerex_strtolower($title), array(themerex_strtolower(__('All Posts', 'themerex')))) && ($blog_id = getTemplatePageId('blog')) > 0) { $rez_all = '<a class="all" href="' . get_permalink($blog_id) . '">' . __('All Posts', 'themerex') . '</a>' . (!empty($rez_all) ? $args['delimiter'] : '') . $rez_all; } $rez3 = ''; if ($type == 'tribe_day' && is_object($post)) { $rez3 .= (!empty($rez3) ? $args['delimiter'] : '') . '<a class="cat_parent" href="' . tribe_get_gridview_link(false) . '">' . date_i18n(tribe_get_option('monthAndYearFormat', 'F Y'), strtotime(tribe_get_month_view_date())) . '</a>'; } else { if (themerex_strpos($type, 'woocommerce') === false && is_archive() && is_object($post)) { $year = get_the_time('Y'); $month = get_the_time('m'); if (is_day() || is_month()) { $rez3 .= (!empty($rez3) ? $args['delimiter'] : '') . '<a class="cat_parent" href="' . get_year_link($year) . '">' . $year . '</a>'; } if (is_day()) { $rez3 .= (!empty($rez3) ? $args['delimiter'] : '') . '<a class="cat_parent" href="' . get_month_link($year, $month) . '">' . prepareDateForTranslation(get_the_date('F')) . '</a>'; } } } if (!is_front_page()) { // && !is_home() $rez .= (isset($args['home']) && $args['home'] != '' ? '<a class="home" href="' . ($args['home_url'] ? $args['home_url'] : home_url()) . '">' . $args['home'] . '</a>' . $args['delimiter'] : '') . (!empty($rez_all) ? $rez_all . $args['delimiter'] : '') . (!empty($rez_level) ? $rez_level . $args['delimiter'] : '') . (!empty($rez2) ? $rez2 . $args['delimiter'] : '') . (!empty($rez3) ? $rez3 . $args['delimiter'] : '') . ($title ? '<span class="current">' . $title . '</span>' : ''); } } if ($args['echo'] && !empty($rez)) { echo balanceTags($rez); } return $rez; }