public function handle() { $deps = array_merge($this->deps, array('jquery'), Tribe__Events__Template_Factory::get_vendor_scripts()); $path = Tribe__Events__Template_Factory::getMinFile(tribe_events_resource_url('tribe-events.js'), true); $handle = $this->prefix . '-calendar-script'; wp_enqueue_script($handle, $path, $deps, $this->filter_js_version()); $js_config_array = array('permalink_settings' => get_option('permalink_structure'), 'events_post_type' => Tribe__Events__Main::POSTTYPE, 'events_base' => tribe_get_events_link()); wp_localize_script($handle, 'tribe_js_config', $js_config_array); }
public static function print_all_events_link() { if (tribe_is_recurring_event()) { ?> <p class="tribe-events-back tribe-events-loop"> <a href="<?php echo esc_url(tribe_get_events_link()); ?> "> <?php printf('« ' . esc_html__('All %s', 'the-events-calendar'), tribe_get_event_label_plural()); ?> </a> </p> <?php } }
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; }
function themefusion_breadcrumb() { global $smof_data, $post; echo '<ul class="breadcrumbs">'; if (!is_front_page()) { echo '<li>' . $smof_data['breacrumb_prefix'] . ' <a href="'; echo home_url(); echo '">' . __('Početna', 'Avada'); echo "</a></li>"; } $params['link_none'] = ''; $separator = ''; if (is_category() && !is_singular('avada_portfolio')) { $category = get_the_category(); $ID = $category[0]->cat_ID; echo is_wp_error($cat_parents = get_category_parents($ID, TRUE, '', FALSE)) ? '' : '<li>' . $cat_parents . '</li>'; } if (is_singular('avada_portfolio')) { echo get_the_term_list($post->ID, 'portfolio_category', '<li>', ' / ', '</li>'); echo '<li>' . get_the_title() . '</li>'; } if (is_singular('event')) { $terms = get_the_term_list($post->ID, 'event-categories', '<li>', ' / ', '</li>'); if (!is_wp_error($terms)) { echo get_the_term_list($post->ID, 'event-categories', '<li>', ' / ', '</li>'); } echo '<li>' . get_the_title() . '</li>'; } if (is_tax()) { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); echo '<li>' . $term->name . '</li>'; } if (is_home()) { echo '<li>' . $smof_data['blog_title'] . '</li>'; } if (is_page() && !is_front_page()) { $parents = array(); $parent_id = $post->post_parent; while ($parent_id) { $page = get_page($parent_id); if ($params["link_none"]) { $parents[] = get_the_title($page->ID); } else { $parents[] = '<li><a href="' . get_permalink($page->ID) . '" title="' . get_the_title($page->ID) . '">' . get_the_title($page->ID) . '</a></li>' . $separator; } $parent_id = $page->post_parent; } $parents = array_reverse($parents); echo join('', $parents); echo '<li>' . get_the_title() . '</li>'; } if (is_single() && !is_singular('avada_portfolio') && !is_singular('tribe_events') && !is_singular('event') && !is_singular('wpfc_sermon')) { $categories_1 = get_the_category($post->ID); if ($categories_1) { foreach ($categories_1 as $cat_1) { $cat_1_ids[] = $cat_1->term_id; } $cat_1_line = implode(',', $cat_1_ids); } if ($cat_1_line) { $categories = get_categories(array('include' => $cat_1_line, 'orderby' => 'id')); if ($categories) { foreach ($categories as $cat) { $cats[] = '<li><a href="' . get_category_link($cat->term_id) . '" title="' . $cat->name . '">' . $cat->name . '</a></li>'; } echo join('', $cats); } } echo '<li>' . get_the_title() . '</li>'; } if (is_tag()) { echo '<li>' . "Tag: " . single_tag_title('', FALSE) . '</li>'; } if (is_search()) { echo '<li>' . __("Pretraži", 'Avada') . '</li>'; } if (is_year()) { echo '<li>' . get_the_time('Y') . '</li>'; } if (is_404()) { if (class_exists('TribeEvents') && tribe_is_event() || is_events_archive()) { echo '<li>' . tribe_get_events_title() . '</li>'; } else { echo '<li>' . __("404 - Stranica nije pronađena", 'Avada') . '</li>'; } } if (class_exists('TribeEvents') && tribe_is_event() && !is_404()) { if (is_singular('tribe_events')) { echo sprintf('<li><a href="%s" title="%s">%s</a></li>', tribe_get_events_link(), tribe_get_events_title(), tribe_get_events_title()); echo '<li>' . get_the_title() . '</li>'; } else { echo '<li>' . tribe_get_events_title() . '</li>'; } } echo "</ul>"; }
/** * Sets the page title for the various PRO views. * * @param string $title The current title. * * @return string The modified title. */ public function reset_page_title($title, $depth = true) { global $wp_query; $tec = Tribe__Events__Main::instance(); $date_format = apply_filters('tribe_events_pro_page_title_date_format', tribe_get_date_format(true)); if (tribe_is_showing_all()) { $reset_title = sprintf(__('All %1$s for %2$s', 'tribe-events-calendar-pro'), strtolower($this->plural_event_label), get_the_title()); } // week view title if (tribe_is_week()) { $reset_title = sprintf(__('%1$s for week of %2$s', 'tribe-events-calendar-pro'), $this->plural_event_label, date_i18n($date_format, strtotime(tribe_get_first_week_day($wp_query->get('start_date'))))); } if (!empty($reset_title) && is_tax($tec->get_event_taxonomy()) && $depth) { $cat = get_queried_object(); $reset_title = '<a href="' . tribe_get_events_link() . '">' . $reset_title . '</a>'; $reset_title .= ' › ' . $cat->name; } return isset($reset_title) ? $reset_title : $title; }
if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } $events_label_singular = tribe_get_event_label_singular(); $events_label_plural = tribe_get_event_label_plural(); $event_id = get_the_ID(); ?> <div id="tribe-events-content" class="tribe-events-single vevent hentry"> <p class="tribe-events-back"> <a href="<?php echo esc_url( tribe_get_events_link() ); ?>"> <?php printf( __( '« All %s', 'tribe-events-calendar' ), $events_label_plural ); ?></a> </p> <!-- Notices --> <?php tribe_events_the_notices() ?> <?php the_title( '<h2 class="tribe-events-single-event-title summary entry-title">', '</h2>' ); ?> <div class="tribe-events-schedule updated published tribe-clearfix"> <?php echo tribe_events_event_schedule_details( $event_id, '<h3>', '</h3>' ); ?> <?php if ( tribe_get_cost() ) : ?> <span class="tribe-events-divider">|</span> <span class="tribe-events-cost"><?php echo tribe_get_cost( null, true ) ?></span> <?php endif; ?> </div>
/** * display the events slug description * * @return string, the string to display */ function tribe_display_current_events_slug() { echo '<p class="tribe-field-indent tribe-field-description description">' . __('The slug used for building the events URL.', 'tribe-events-calendar') . sprintf(__('Your current Events URL is %s', 'tribe-events-calendar'), '<code><a href="' . tribe_get_events_link() . '">' . tribe_get_events_link() . '</a></code>') . '</p>'; }
function wpex_breadcrumbs($post_id = '') { // Globals global $wp_query, $wp_rewrite; // Get post id $post_id = $post_id ? $post_id : wpex_get_the_id(); // Define main variables $breadcrumb = ''; $trail = array(); $path = ''; $item_type_scope = 'itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"'; // Default arguments $args = array('separator' => wpex_element('angle_right'), 'front_page' => false, 'echo' => false, 'show_posts_page' => true); // Extract args for easy variable naming. extract($args); /*-----------------------------------------------------------------------------------*/ /* - If not on the front page of the site, link to the home page /*-----------------------------------------------------------------------------------*/ if (!is_front_page()) { $home_title = get_theme_mod('breadcrumbs_home_title') ? get_theme_mod('breadcrumbs_home_title') : __('Home', 'wpex'); $trail[] = '<span ' . $item_type_scope . '> <a href="' . home_url() . '" title="' . esc_attr(get_bloginfo('name')) . '" rel="home" class="trail-begin"> <span itemprop="title">' . $home_title . '</span> </a> </span>'; } /*-----------------------------------------------------------------------------------*/ /* - Front Page /*-----------------------------------------------------------------------------------*/ if (is_front_page()) { if (!$front_page) { $trail = false; } elseif ($show_home) { $trail['trail_end'] = "{$show_home}"; } } elseif (is_home()) { $home_page = get_page($wp_query->get_queried_object_id()); $trail = array_merge($trail, wpex_breadcrumbs_get_parents($home_page->post_parent, '')); $trail['trail_end'] = get_the_title($home_page->ID); } elseif (is_singular()) { // Get singular vars $post = $wp_query->get_queried_object(); $post_id = absint($wp_query->get_queried_object_id()); $post_type = $post->post_type; $parent = $post->post_parent; // If a custom post type, check if there are any pages in its hierarchy based on the slug. if (!in_array($post_type, array('page', 'post', 'product', 'portfolio', 'staff', 'testimonials'))) { $post_type_object = get_post_type_object($post_type); // Add $front to the path if ('post' == $post_type || 'attachment' == $post_type || $post_type_object->rewrite['with_front'] && $wp_rewrite->front) { $path .= trailingslashit($wp_rewrite->front); } // Add slug to $path if (!empty($post_type_object->rewrite['slug'])) { $path .= $post_type_object->rewrite['slug']; } // If $path exists check for parents if (!empty($path)) { $trail = array_merge($trail, wpex_breadcrumbs_get_parents('', $path)); } // If archive page exists add to trail if (!empty($post_type_object->has_archive) && function_exists('get_post_type_archive_link')) { if (!is_singular('product')) { $trail[] = '<span ' . $item_type_scope . ' class="trail-type-archive"> <a href="' . get_post_type_archive_link($post_type) . '" title="' . esc_attr($post_type_object->labels->name) . '"> <span itemprop="title">' . $post_type_object->labels->name . '</span> </a> </span>'; } } } // Add shop page to cart if (is_singular('page') && class_exists('Woocommerce')) { if (is_cart() || is_checkout()) { // Get shop page if (class_exists('Woocommerce') && function_exists('wc_get_page_id')) { $shop_id = wc_get_page_id('shop'); $shop_page_url = get_permalink($shop_id); $shop_title = get_the_title($shop_id); if (function_exists('icl_object_id')) { $shop_title = get_the_title(icl_object_id($shop_id, 'page')); } $shop_title = apply_filters('wpex_bcrums_shop_title', $shop_title); } // Shop page if ($shop_id && $shop_title) { $trail[] = '<span ' . $item_type_scope . ' class="trail-type-archive"> <a href="' . get_permalink($shop_id) . '" title="' . esc_attr($shop_title) . '"> <span itemprop="title">' . $shop_title . '</span> </a> </span>'; } } } // Standard Posts if ('post' == $post_type) { // Main Blog URL if ($blog_page = get_theme_mod('blog_page')) { $blog_url = get_permalink($blog_page); $blog_name = get_the_title($blog_page); if (function_exists('icl_object_id')) { $blog_name = get_the_title(icl_object_id($blog_page, 'page')); } $trail[] = '<span ' . $item_type_scope . ' class="trail-blog-url"> <a href="' . $blog_url . '" title="' . $blog_name . '" itemprop="url"> <span itemprop="title">' . $blog_name . '</span> </a> </span>'; } // 1st Category if (get_theme_mod('breadcrumbs_blog_cat', '1')) { $terms = get_the_terms($post_id, 'category'); if ($terms) { $term = reset($terms); $trail[] = '<span ' . $item_type_scope . ' class="trail-blog-cat"> <a href="' . get_term_link($term) . '" itemprop="url" title="' . $term->name . '"> <span itemprop="title">' . $term->name . '</span> </a> </span>'; } } } // Tribe Events if ('tribe_events' == $post_type && function_exists('tribe_get_events_link')) { $trail[] = '<span ' . $item_type_scope . ' class="trail-portfolio-url"> <a href="' . tribe_get_events_link() . '" title="' . __('All Events', 'wpex') . '"> <span itemprop="title">' . __('All Events', 'wpex') . '</span> </a> </span>'; } // Main Portfolio if ($post_type == 'portfolio') { if ($portfolio_page = get_theme_mod('portfolio_page')) { $portfolio_url = get_permalink($portfolio_page); $portfolio_name = get_the_title($portfolio_page); if (function_exists('icl_object_id')) { $portfolio_name = get_the_title(icl_object_id($portfolio_page, 'page')); } if ($portfolio_url) { $trail[] = '<span ' . $item_type_scope . ' class="trail-portfolio-url"> <a href="' . $portfolio_url . '" title="' . $portfolio_name . '"> <span itemprop="title">' . $portfolio_name . '</span> </a> </span>'; } } // Portfolio 1st Category if (get_theme_mod('breadcrumbs_portfolio_cat', '1') && taxonomy_exists('portfolio_category')) { $terms = get_the_terms($post_id, 'portfolio_category'); if ($terms) { $term = reset($terms); $trail[] = '<span ' . $item_type_scope . ' class="trail-portfolio-cat"> <a href="' . get_term_link($term) . '" itemprop="url" title="' . $term->name . '"> <span itemprop="title">' . $term->name . '</span> </a> </span>'; } } } // Main Staff if ($post_type == 'staff') { // Display staff page if ($staff_page = get_theme_mod('staff_page')) { $staff_url = get_permalink($staff_page); $staff_name = get_the_title($staff_page); if (function_exists('icl_object_id')) { $staff_name = get_the_title(icl_object_id($staff_page, 'page')); } if ($staff_url) { $trail[] = '<span ' . $item_type_scope . ' class="trail-staff-url"> <a href="' . $staff_url . '" title="' . $staff_name . '"> <span itemprop="title">' . $staff_name . '</span> </a> </span>'; } } // Staff 1st Category if (get_theme_mod('breadcrumbs_staff_cat', '1') && taxonomy_exists('staff_category')) { $terms = get_the_terms($post_id, 'staff_category'); if ($terms) { $term = reset($terms); $trail[] = '<span ' . $item_type_scope . '> <a href="' . get_term_link($term) . '" itemprop="url" title="' . $term->name . '"> <span itemprop="title">' . $term->name . '</span> </a> </span>'; } } } // Main Testimonials if ($post_type == 'testimonials') { // Display testimonials page if ($testimonials_page = get_theme_mod('testimonials_page')) { $testimonials_url = get_permalink($testimonials_page); $testimonials_name = get_the_title($testimonials_page); if (function_exists('icl_object_id')) { $testimonials_name = get_the_title(icl_object_id($testimonials_page, 'page')); } if ($testimonials_url) { $trail[] = '<span ' . $item_type_scope . ' class="trail-testimonials-url"> <a href="' . $testimonials_url . '" title="' . $testimonials_name . '"> <span itemprop="title">' . $testimonials_name . '</span> </a> </span>'; } } // Testimonials 1st Category if (get_theme_mod('breadcrumbs_testimonials_cat', '1') && taxonomy_exists('testimonials_category')) { $terms = get_the_terms($post_id, 'testimonials_category'); if ($terms) { $term = reset($terms); $trail[] = '<span ' . $item_type_scope . '> <a href="' . get_term_link($term) . '" itemprop="url" title="' . $term->name . '"> <span itemprop="title">' . $term->name . '</span> </a> </span>'; } } } // Products if (is_singular('product') && class_exists('Woocommerce')) { // Globals global $woocommerce; // Get shop page if (class_exists('Woocommerce') && function_exists('wc_get_page_id')) { $shop_id = wc_get_page_id('shop'); $shop_page_url = get_permalink($shop_id); $shop_title = get_the_title($shop_id); if (function_exists('icl_object_id')) { $shop_title = get_the_title(icl_object_id($shop_id, 'page')); } $shop_title = apply_filters('wpex_bcrums_shop_title', $shop_title); } // Shop page if ($shop_id && $shop_title) { $trail[] = '<span ' . $item_type_scope . ' class="trail-type-archive"> <a href="' . get_permalink($shop_id) . '" title="' . esc_attr($shop_title) . '"> <span itemprop="title">' . $shop_title . '</span> </a> </span>'; } // Cart page if (sizeof($woocommerce->cart->cart_contents) > 0) { $cart_id = wc_get_page_id('cart'); $cart_title = get_the_title($cart_id); if ($cart_id) { $trail[] = '<span ' . $item_type_scope . ' class="trail-type-archive"> <a href="' . get_permalink($cart_id) . '" title="' . esc_attr($cart_title) . '"> <span itemprop="title">' . $cart_title . '</span> </a> </span>'; } } } // If the post type path returns nothing and there is a parent, get its parents. if (empty($path) && 0 !== $parent || 'attachment' == $post_type) { $trail = array_merge($trail, wpex_breadcrumbs_get_parents($parent, '')); } // End trail with post title $post_title = get_the_title($post_id); if (!empty($post_title)) { if ($trim_title = get_theme_mod('breadcrumbs_title_trim', '4')) { $post_title = wp_trim_words($post_title, $trim_title); $trail['trail_end'] = $post_title; } else { $trail['trail_end'] = $post_title; } } } elseif (is_archive()) { // Add cart to shop if (function_exists('is_shop') && is_shop()) { global $woocommerce; if (sizeof($woocommerce->cart->cart_contents) > 0) { $cart_id = wc_get_page_id('cart'); $cart_title = get_the_title($cart_id); if ($cart_id) { $trail[] = '<span ' . $item_type_scope . ' class="trail-type-archive"> <a href="' . get_permalink($cart_id) . '" title="' . esc_attr($cart_title) . '"> <span itemprop="title">' . $cart_title . '</span> </a> </span>'; } } } // Topics if (is_post_type_archive('topic')) { $forums_link = get_post_type_archive_link('forum'); $forum_obj = get_post_type_object('forum'); $forum_name = $forum_obj->labels->name; if ($forums_link) { $trail[] = '<span ' . $item_type_scope . '><a href="' . $forums_link . '" title="' . $forum_name . '">' . $forum_name . '</a></span>'; } } /*-----------------------------------------------------------------------------------*/ /* - Taxonomies /*-----------------------------------------------------------------------------------*/ if (is_tax() || is_category() || is_tag()) { // Get some taxonomy variables $term = $wp_query->get_queried_object(); $taxonomy = get_taxonomy($term->taxonomy); // Link to main portfolio page if (function_exists('wpex_is_portfolio_tax') && wpex_is_portfolio_tax() && ($portfolio_page = get_theme_mod('portfolio_page'))) { $portfolio_url = get_permalink($portfolio_page); $portfolio_name = get_the_title($portfolio_page); if (function_exists('icl_object_id')) { $portfolio_name = get_the_title(icl_object_id($portfolio_page, 'page')); } if ($portfolio_url) { $trail[] = '<span ' . $item_type_scope . ' class="trail-portfolio-url"> <a href="' . $portfolio_url . '" title="' . $portfolio_name . '"> <span itemprop="title">' . $portfolio_name . '</span> </a> </span>'; } } // Link to main staff page if (function_exists('wpex_is_staff_tax') && wpex_is_staff_tax() && ($staff_page = get_theme_mod('staff_page'))) { $staff_url = get_permalink($staff_page); $staff_name = get_the_title($staff_page); if (function_exists('icl_object_id')) { $staff_name = get_the_title(icl_object_id($staff_page, 'page')); } if ($staff_url) { $trail[] = '<span ' . $item_type_scope . ' class="trail-staff-url"> <a href="' . $staff_url . '" title="' . $staff_name . '"> <span itemprop="title">' . $staff_name . '</span> </a> </span>'; } } // Testimonials Tax if (function_exists('wpex_is_testimonials_tax') && wpex_is_testimonials_tax() && ($testimonials_page = get_theme_mod('testimonials_page'))) { $testimonials_url = get_permalink($testimonials_page); $testimonials_name = get_the_title($testimonials_page); if (function_exists('icl_object_id')) { $testimonials_name = get_the_title(icl_object_id($testimonials_page, 'page')); } if ($testimonials_url) { $trail[] = '<span ' . $item_type_scope . ' class="trail-testimonials-url"> <a href="' . $testimonials_url . '" title="' . $testimonials_name . '"> <span itemprop="title">' . $testimonials_name . '</span> </a> </span>'; } } // Woo Product Tax if (function_exists('wpex_is_woo_tax') && wpex_is_woo_tax()) { // Get shop page if (class_exists('Woocommerce') && function_exists('wc_get_page_id')) { $shop_id = wc_get_page_id('shop'); $shop_page_url = get_permalink($shop_id); $shop_title = get_the_title($shop_id); if (function_exists('icl_object_id')) { $shop_title = get_the_title(icl_object_id($shop_id, 'page')); } $shop_title = apply_filters('wpex_bcrums_shop_title', $shop_title); } if ($shop_page_url && $shop_title) { $trail[] = '<span ' . $item_type_scope . ' class="trail-shop"> <a href="' . $shop_page_url . '" title="' . $shop_title . '" itemprop="url"> <span itemprop="title">' . $shop_title . '</span> </a> </span>'; } } // Display main blog page on Categories & archives if (is_category() || is_tag()) { if ($blog_page = get_theme_mod('blog_page')) { $blog_url = get_permalink($blog_page); $blog_name = get_the_title($blog_page); if (function_exists('icl_object_id')) { $blog_name = get_the_title(icl_object_id($blog_page, 'page')); } $trail[] = '<span ' . $item_type_scope . ' class="trail-blog-url"> <a href="' . $blog_url . '" title="' . $blog_name . '" itemprop="url"> <span itemprop="title">' . $blog_name . '</span> </a> </span>'; } } // Get the path to the term archive. Use this to determine if a page is present with it. if (is_category()) { $path = get_option('category_base'); } elseif (is_tag()) { $path = get_option('tag_base'); } else { if ($taxonomy->rewrite['with_front'] && $wp_rewrite->front) { $path = trailingslashit($wp_rewrite->front); } $path .= $taxonomy->rewrite['slug']; } // Get parent pages if they exist if ($path) { $trail = array_merge($trail, wpex_breadcrumbs_get_parents('', $path)); } // Add term parents if (is_taxonomy_hierarchical($term->taxonomy) && $term->parent) { $trail = array_merge($trail, wpex_breadcrumbs_get_term_parents($term->parent, $term->taxonomy)); } // Add term name to trail end $trail['trail_end'] = $term->name; } elseif (is_post_type_archive()) { // Get post type object $post_type_object = get_post_type_object(get_query_var('post_type')); // Add $front to $path if ($post_type_object->rewrite['with_front'] && $wp_rewrite->front) { $path .= trailingslashit($wp_rewrite->front); } // Add slug to 4path if (!empty($post_type_object->rewrite['archive'])) { $path .= $post_type_object->rewrite['archive']; } // If patch exists check for parents if (!empty($path)) { $trail = array_merge($trail, wpex_breadcrumbs_get_parents('', $path)); } // Add post type name to trail end $trail['trail_end'] = $post_type_object->labels->name; } elseif (is_author()) { /* If $front has been set, add it to $path. */ if (!empty($wp_rewrite->front)) { $path .= trailingslashit($wp_rewrite->front); } /* If an $author_base exists, add it to $path. */ if (!empty($wp_rewrite->author_base)) { $path .= $wp_rewrite->author_base; } /* If $path exists, check for parent pages. */ if (!empty($path)) { $trail = array_merge($trail, wpex_breadcrumbs_get_parents('', $path)); } /* Add the author's display name to the trail end. */ $trail['trail_end'] = get_the_author_meta('display_name', get_query_var('author')); } elseif (is_time()) { if (get_query_var('minute') && get_query_var('hour')) { $trail['trail_end'] = get_the_time(__('g:i a', 'wpex')); } elseif (get_query_var('minute')) { $trail['trail_end'] = sprintf(__('Minute %1$s', 'wpex'), get_the_time(__('i', 'wpex'))); } elseif (get_query_var('hour')) { $trail['trail_end'] = get_the_time(__('g a', 'wpex')); } } elseif (is_date()) { // If $front is set check for parents if ($wp_rewrite->front) { $trail = array_merge($trail, wpex_breadcrumbs_get_parents('', $wp_rewrite->front)); } if (is_day()) { $trail[] = '<a href="' . get_year_link(get_the_time('Y')) . '" title="' . get_the_time(esc_attr__('Y', 'wpex')) . '">' . get_the_time(__('Y', 'wpex')) . '</a>'; $trail[] = '<a href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '" title="' . get_the_time(esc_attr__('F', 'wpex')) . '">' . get_the_time(__('F', 'wpex')) . '</a>'; $trail['trail_end'] = get_the_time(__('j', 'wpex')); } elseif (get_query_var('w')) { $trail[] = '<a href="' . get_year_link(get_the_time('Y')) . '" title="' . get_the_time(esc_attr__('Y', 'wpex')) . '">' . get_the_time(__('Y', 'wpex')) . '</a>'; $trail['trail_end'] = sprintf(__('Week %1$s', 'wpex'), get_the_time(esc_attr__('W', 'wpex'))); } elseif (is_month()) { $trail[] = '<a href="' . get_year_link(get_the_time('Y')) . '" title="' . get_the_time(esc_attr__('Y', 'wpex')) . '">' . get_the_time(__('Y', 'wpex')) . '</a>'; $trail['trail_end'] = get_the_time(__('F', 'wpex')); } elseif (is_year()) { $trail['trail_end'] = get_the_time(__('Y', 'wpex')); } } } elseif (is_search()) { $trail['trail_end'] = sprintf(__('Search results for "%1$s"', 'wpex'), esc_attr(get_search_query())); } elseif (is_404()) { $trail['trail_end'] = get_theme_mod('error_page_title') ? get_theme_mod('error_page_title') : __('404 Not Found', 'wpex'); } elseif (function_exists('tribe_is_month') && tribe_is_month()) { $trail['trail_end'] = __('Events Calendar', 'wpex'); } /*-----------------------------------------------------------------------------------*/ /* - Create and return the breadcrumbs /*-----------------------------------------------------------------------------------*/ if ($trail && is_array($trail)) { $classes = 'site-breadcrumbs clr'; if ($breadcrumbs_position = get_theme_mod('breadcrumbs_position')) { $classes .= ' position-' . $breadcrumbs_position; } // Open Breadcrumbs $breadcrumb = '<nav class="' . $classes . '"><div class="breadcrumb-trail">'; // Seperator HTML $separator = '<span class="sep">' . $separator . '</span>'; // Join all trail items into a string $breadcrumb .= implode($separator, $trail); // Close breadcrumbs $breadcrumb .= '</div></nav>'; } // Return the breadcrumbs trail return $breadcrumb; }
/** * @deprecated */ function sp_get_events_link() { _deprecated_function(__FUNCTION__, '2.0', 'tribe_get_events()'); return tribe_get_events_link(); }
private function generate_crumbs() { // Globals global $wp_query, $wp_rewrite; // Get post id $post_id = $this->post_id; // Define main variables $breadcrumb = $path = ''; $trail = array(); $item_type_scope = $this->itemscope; // Home text $home_text = wpex_get_translated_theme_mod('breadcrumbs_home_title'); $home_text = $home_text ? $home_text : '<span class="fa fa-home"></span><span class="display-none">' . esc_html_x('Home', 'breadcrumbs', 'total') . '</span>'; // Default arguments $args = apply_filters('wpex_breadcrumbs_args', array('home_text' => $home_text, 'home_link' => home_url('/'), 'separator' => wpex_element('angle_right'), 'front_page' => false, 'show_posts_page' => true)); // Extract args for easy variable naming. extract($args); /*-----------------------------------------------------------------------------------*/ /* - Homepage link /*-----------------------------------------------------------------------------------*/ $trail['trail_start'] = '<span ' . esc_attr($item_type_scope) . '><a href="' . esc_url($home_link) . '" title="' . esc_attr(get_bloginfo('name')) . '" rel="home" class="trail-begin" itemprop="url"><span itemprop="title">' . $home_text . '</span></a></span>'; /*-----------------------------------------------------------------------------------*/ /* - Front Page /*-----------------------------------------------------------------------------------*/ if (is_front_page()) { if (!$front_page) { $trail = false; } elseif ($show_home) { $trail['trail_end'] = "{$show_home}"; } } elseif (is_home()) { $home_page = get_page($wp_query->get_queried_object_id()); if (is_object($home_page)) { $trail = array_merge($trail, $this->get_post_parents($home_page->post_parent, '')); $trail['trail_end'] = '<span itemprop="title">' . get_the_title($home_page->ID) . '</span>'; } } elseif (is_singular()) { // Get singular vars $post = $wp_query->get_queried_object(); $post_id = absint($wp_query->get_queried_object_id()); $post_type = $post->post_type; $parent = $post->post_parent; // Pages if ('page' == $post_type) { // Woo pages if (WPEX_WOOCOMMERCE_ACTIVE) { // Add shop page to cart if (is_cart() || is_checkout()) { // Get shop data $shop_data = $this->get_shop_data(); $shop_url = $shop_data['url']; $shop_title = $shop_data['title']; // Add shop link if ($shop_url && $shop_title) { $trail['shop'] = '<span ' . esc_attr($item_type_scope) . ' class="trail-shop"><a href="' . esc_url($shop_url) . '" title="' . esc_attr($shop_title) . '" itemprop="url"><span itemprop="title">' . esc_html($shop_title) . '</span></a></span>'; } } // Add cart to checkout if (is_checkout()) { $cart_id = wpex_parse_obj_id(wc_get_page_id('cart'), 'page'); if ($cart_id) { $cart_title = get_the_title($cart_id); $trail['cart'] = '<span ' . esc_attr($item_type_scope) . ' class="trail-type-archive trail-cart"><a href="' . esc_url(get_permalink($cart_id)) . '" title="' . esc_attr($cart_title) . '" itemprop="url"><span itemprop="title">' . $cart_title . '</span></a></span>'; } } } } elseif ('post' == $post_type) { // Main Blog URL $page_id = wpex_parse_obj_id(wpex_get_mod('blog_page'), 'page'); if ($page_id) { $page_permalink = get_permalink($page_id); $page_name = get_the_title($page_id); if ($page_permalink && $page_name) { $trail['blog'] = '<span ' . esc_attr($item_type_scope) . ' class="trail-blog-url"> <a href="' . esc_url($page_permalink) . '" title="' . esc_attr($page_name) . '" itemprop="url"><span itemprop="title">' . $page_name . '</span></a></span>'; } } // Categories if ($terms = $this->get_post_terms($taxonomy = 'category')) { $trail['categories'] = '<span class="trail-post-categories">' . $terms . '</span>'; } } elseif ('tribe_events' == $post_type) { if (function_exists('tribe_get_events_link')) { $trail['tribe_events'] = '<span ' . esc_attr($item_type_scope) . ' class="trail-all-events"><a href="' . esc_url(tribe_get_events_link()) . '" title="' . esc_attr__('All Events', 'total') . '" itemprop="url"><span itemprop="title">' . esc_html__('All Events', 'total') . '</span></a></span>'; } } elseif ('portfolio' == $post_type) { // Portfolio main page $page_id = wpex_parse_obj_id(wpex_get_mod('portfolio_page'), 'page'); if ($page_id) { $page_permalink = get_permalink($page_id); $page_name = get_the_title($page_id); if ($page_permalink && $page_name) { $trail['portfolio'] = '<span ' . esc_attr($item_type_scope) . ' class="trail-portfolio-url"> <a href="' . esc_url($page_permalink) . '" title="' . esc_attr($page_name) . '" itemprop="url"><span itemprop="title">' . $page_name . '</span></a></span>'; } } // Portfolio Categories if ($terms = $this->get_post_terms($taxonomy = 'portfolio_category')) { $trail['categories'] = '<span class="trail-post-categories">' . $terms . '</span>'; } } elseif ('staff' == $post_type) { // Staff main page $page_id = wpex_parse_obj_id(wpex_get_mod('staff_page'), 'page'); if ($page_id) { $page_permalink = get_permalink($page_id); $page_name = get_the_title($page_id); if ($page_permalink && $page_name) { $trail['staff'] = '<span ' . esc_attr($item_type_scope) . ' class="trail-staff-url"> <a href="' . esc_url($page_permalink) . '" title="' . esc_attr($page_name) . '" itemprop="url"><span itemprop="title">' . $page_name . '</span></a></span>'; } } // Staff Categories if ($terms = $this->get_post_terms($taxonomy = 'staff_category')) { $trail['categories'] = '<span class="trail-post-categories">' . $terms . '</span>'; } } elseif ('testimonials' == $post_type) { // Testimonials main page $page_id = wpex_parse_obj_id(wpex_get_mod('testimonials_page'), 'page'); if ($page_id) { $page_permalink = get_permalink($page_id); $page_name = get_the_title($page_id); if ($page_permalink && $page_name) { $trail['testimonials'] = '<span ' . esc_attr($item_type_scope) . ' class="trail-testimonials-url"> <a href="' . esc_url($page_permalink) . '" title="' . esc_attr($page_name) . '" itemprop="url"><span itemprop="title">' . $page_name . '</span></a></span>'; } } // Testimonials Categories if ($terms = $this->get_post_terms($taxonomy = 'testimonials_category')) { $trail['categories'] = '<span class="trail-post-categories">' . $terms . '</span>'; } } elseif ('product' == $post_type) { // Get shop data $shop_data = $this->get_shop_data(); $shop_url = $shop_data['url']; $shop_title = $shop_data['title']; // Add shop page to product post if ($shop_url && $shop_title) { $trail['shop'] = '<span ' . esc_attr($item_type_scope) . '><a href="' . esc_url($shop_url) . '" title="' . esc_attr($shop_title) . '" itemprop="url"><span itemprop="title">' . $shop_title . '</span></a></span>'; } // Add categories to product post if ($terms = $this->get_post_terms($taxonomy = 'product_cat')) { $trail['categories'] = '<span class="trail-post-categories">' . $terms . '</span>'; } // Add cart to product post if (apply_filters('wpex_breadcrumbs_single_product_cart', false)) { $cart_id = wpex_parse_obj_id(wc_get_page_id('cart')); if ($cart_id) { $cart_title = get_the_title($cart_id); $trail['cart'] = '<span ' . esc_attr($item_type_scope) . '><a href="' . esc_url(get_permalink($cart_id)) . '" title="' . esc_attr($cart_title) . '" itemprop="url"><span itemprop="title">' . $cart_title . '</span></a></span>'; } } } else { $post_type_object = get_post_type_object($post_type); // Add $front to the path if ('post' == $post_type || $post_type_object->rewrite['with_front'] && $wp_rewrite->front) { $path .= trailingslashit($wp_rewrite->front); } // Add slug to $path if (!empty($post_type_object->rewrite['slug'])) { $path .= $post_type_object->rewrite['slug']; } // If archive page exists add to trail if (!empty($post_type_object->has_archive) && !is_singular('product')) { $trail['post_type_archive'] = '<span ' . esc_attr($item_type_scope) . ' class="trail-type-archive"><a href="' . esc_url(get_post_type_archive_link($post_type)) . '" title="' . esc_attr($post_type_object->labels->name) . '" itemprop="url"><span itemprop="title">' . $post_type_object->labels->name . '</span></a></span>'; } else { // If $path exists check for parents if (!empty($path)) { $trail = array_merge($trail, $this->get_post_parents('', $path)); } } } // If the post type path returns nothing and there is a parent, get its parents. if (empty($path) && $parent && 'attachment' != $post_type) { $trail = array_merge($trail, $this->get_post_parents($parent)); } // End trail with post title if ($post_title = get_the_title($post_id)) { if ($trim_title = wpex_get_mod('breadcrumbs_title_trim')) { $post_title = wp_trim_words($post_title, $trim_title); } $trail['trail_end'] = $post_title; } } elseif (is_archive()) { /*-----------------------------------------------------------------------------------*/ /* - Post Type Archive /*-----------------------------------------------------------------------------------*/ if (is_post_type_archive()) { // Shop Archive if (function_exists('is_shop') && is_shop()) { global $woocommerce; if (sizeof($woocommerce->cart->cart_contents) > 0) { $cart_id = wc_get_page_id('cart'); if (function_exists('icl_object_id')) { $cart_id = icl_object_id($cart_id, 'page'); } $cart_title = get_the_title($cart_id); if ($cart_id) { $trail['cart'] = '<span ' . esc_attr($item_type_scope) . ' class="trail-type-archive"><a href="' . esc_url(get_permalink($cart_id)) . '" title="' . esc_attr($cart_title) . '" itemprop="url"><span itemprop="title">' . $cart_title . '</span></a></span>'; } } // Get shop page $shop_data = $this->get_shop_data(); // Add shop page title to trail end if ($shop_data['title']) { $trail['trail_end'] = $shop_data['title']; } } elseif (is_post_type_archive('topic')) { $forums_link = get_post_type_archive_link('forum'); $forum_obj = get_post_type_object('forum'); $forum_name = $forum_obj->labels->name; if ($forums_link) { $trail['topics'] = '<span ' . esc_attr($item_type_scope) . '><a href="' . esc_url($forums_link) . '" title="' . esc_attr($forum_name) . '" itemprop="url">' . esc_html($forum_name) . '</a></span>'; } $trail['trail_end'] = $post_type_object->labels->name; // All other post type archives } else { // Get post type object $post_type_object = get_post_type_object(get_query_var('post_type')); // Add $front to $path if ($post_type_object->rewrite['with_front'] && $wp_rewrite->front) { $path .= trailingslashit($wp_rewrite->front); } // Add slug to $path if (!empty($post_type_object->rewrite['archive'])) { $path .= $post_type_object->rewrite['archive']; } // If patch exists check for parents if (!empty($path)) { $trail = array_merge($trail, $this->get_post_parents('', $path)); } // Add post type name to trail end $trail['trail_end'] = $post_type_object->labels->name; } } elseif (!is_search() && (is_tax() || is_category() || is_tag())) { // Get some taxonomy variables $term = $wp_query->get_queried_object(); $taxonomy = get_taxonomy($term->taxonomy); // Link to main portfolio page if (function_exists('wpex_is_portfolio_tax') && wpex_is_portfolio_tax() && ($portfolio_page = wpex_get_mod('portfolio_page'))) { $portfolio_url = get_permalink($portfolio_page); $portfolio_name = get_the_title($portfolio_page); if (function_exists('icl_object_id')) { $portfolio_page = icl_object_id($portfolio_page, 'page'); $portfolio_url = get_permalink($portfolio_page); $portfolio_name = get_the_title($portfolio_page); } if ($portfolio_url) { $trail['portfolio'] = '<span ' . esc_attr($item_type_scope) . ' class="trail-portfolio-url"><a href="' . esc_url($portfolio_url) . '" title="' . esc_attr($portfolio_name) . '" itemprop="url"><span itemprop="title">' . $portfolio_name . '</span></a></span>'; } } // Link to main staff page if (function_exists('wpex_is_staff_tax') && wpex_is_staff_tax() && ($staff_page = wpex_get_mod('staff_page'))) { if (function_exists('icl_object_id')) { $staff_page = icl_object_id($staff_page, 'page'); } $staff_url = get_permalink($staff_page); $staff_name = get_the_title($staff_page); if ($staff_url) { $trail['staff'] = '<span ' . esc_attr($item_type_scope) . ' class="trail-staff-url"><a href="' . esc_url($staff_url) . '" title="' . esc_attr($staff_name) . '" itemprop="url"><span itemprop="title">' . $staff_name . '</span></a></span>'; } } // Testimonials Tax if (function_exists('wpex_is_testimonials_tax') && wpex_is_testimonials_tax() && ($testimonials_page = wpex_get_mod('testimonials_page'))) { $testimonials_url = get_permalink($testimonials_page); $testimonials_name = get_the_title($testimonials_page); if (function_exists('icl_object_id')) { $testimonials_page = icl_object_id($testimonials_page, 'page'); $testimonials_url = get_permalink($testimonials_page); $testimonials_name = get_the_title($testimonials_page); } if ($testimonials_url) { $trail['testimonials'] = '<span ' . esc_attr($item_type_scope) . ' class="trail-testimonials-url"><a href="' . esc_url($testimonials_url) . '" title="' . esc_attr($testimonials_name) . '" itemprop="url"><span itemprop="title">' . $testimonials_name . '</span></a></span>'; } } // Woo Product Tax if (function_exists('wpex_is_woo_tax') && wpex_is_woo_tax()) { // Get shop data $shop_data = $this->get_shop_data(); $shop_url = $shop_data['url']; $shop_title = $shop_data['title']; // Add shop link if ($shop_url && $shop_title) { $trail['shop'] = '<span ' . esc_attr($item_type_scope) . ' class="trail-shop"><a href="' . esc_url($shop_url) . '" title="' . esc_attr($shop_title) . '" itemprop="url"><span itemprop="title">' . $shop_title . '</span></a></span>'; } } // Display main blog page on Categories & archives if (is_category() || is_tag()) { if ($blog_page = wpex_get_mod('blog_page')) { $blog_url = get_permalink($blog_page); $blog_name = get_the_title($blog_page); if (function_exists('icl_object_id')) { $blog_page = icl_object_id($blog_page, 'page'); $blog_url = get_permalink($blog_page); $blog_name = get_the_title($blog_page); } $trail['blog'] = '<span ' . esc_attr($item_type_scope) . ' class="trail-blog-url"><a href="' . esc_url($blog_url) . '" title="' . esc_attr($blog_name) . '" itemprop="url"><span itemprop="title">' . $blog_name . '</span></a></span>'; } } // Get the path to the term archive. Use this to determine if a page is present with it. if (is_category()) { $path = get_option('category_base'); } elseif (is_tag()) { $path = get_option('tag_base'); } else { if ($taxonomy->rewrite['with_front'] && $wp_rewrite->front) { $path = trailingslashit($wp_rewrite->front); } $path .= $taxonomy->rewrite['slug']; } // Get parent pages if they exist if ($path) { $trail = array_merge($trail, $this->get_post_parents('', $path)); } // Add term parents if (is_taxonomy_hierarchical($term->taxonomy) && $term->parent) { $trail = array_merge($trail, $this->get_term_parents($term)); } // Add term name to trail end $trail['trail_end'] = $term->name; } elseif (is_author()) { // If $front has been set, add it to $path. if (!empty($wp_rewrite->front)) { $path .= trailingslashit($wp_rewrite->front); } // If an $author_base exists, add it to $path. if (!empty($wp_rewrite->author_base)) { $path .= $wp_rewrite->author_base; } // If $path exists, check for parent pages. if (!empty($path)) { $trail = array_merge($trail, $this->get_post_parents('', $path)); } // Add the author's display name to the trail end. $trail['trail_end'] = get_the_author_meta('display_name', get_query_var('author')); } elseif (is_time()) { // Display minute and hour if (get_query_var('minute') && get_query_var('hour')) { $trail['trail_end'] = get_the_time('g:i a'); } elseif (get_query_var('minute')) { $trail['trail_end'] = sprintf(esc_html__('Minute %1$s', 'total'), get_the_time('i')); } elseif (get_query_var('hour')) { $trail['trail_end'] = get_the_time('g a'); } } elseif (is_date()) { // If $front is set check for parents if ($wp_rewrite->front) { $trail = array_merge($trail, $this->get_post_parents('', $wp_rewrite->front)); } // Day archive if (is_day()) { // Display year $title = date_i18n('Y', strtotime(get_the_time('Y'))); $trail['year'] = '<a href="' . esc_url(get_year_link(get_the_time('Y'))) . '" title="' . esc_attr($title) . '" itemprop="url">' . esc_html($title) . '</a>'; // Display month $title = date_i18n('F', strtotime(get_the_time('F'))); $trail['month'] = '<a href="' . esc_url(get_month_link(get_the_time('Y'), get_the_time('m'))) . '" title="' . esc_attr($title) . '" itemprop="url">' . esc_html($title) . '</a>'; // Display Time $trail['trail_end'] = date_i18n('j', strtotime(get_the_time('j'))); } elseif (get_query_var('w')) { // Display year $title = date_i18n('Y', strtotime(get_the_time('Y'))); $trail['year'] = '<a href="' . esc_url(get_year_link(get_the_time('Y'))) . '" title="' . esc_attr($title) . '" itemprop="url">' . esc_html($title) . '</a>'; // Display week $trail['trail_end'] = sprintf(esc_html__('Week %1$s', 'total'), get_the_time('W')); } elseif (is_month()) { $title = date_i18n('F', strtotime(get_the_time('F'))); $trail[] = '<a href="' . esc_url(get_year_link(get_the_time('Y'))) . '" title="' . esc_attr($title) . '" itemprop="url">' . esc_html($title) . '</a>'; $trail['trail_end'] = esc_html($title); } elseif (is_year()) { $trail['trail_end'] = date_i18n('Y', strtotime(get_the_time('Y'))); } } } elseif (is_search()) { $trail['trail_end'] = sprintf(esc_html__('Search results for "%1$s"', 'total'), esc_html(get_search_query())); } elseif (is_404()) { $trail['trail_end'] = wpex_get_mod('error_page_title') ? wpex_get_mod('error_page_title') : esc_html__('404 Not Found', 'total'); } elseif (function_exists('tribe_is_month') && tribe_is_month()) { $trail['trail_end'] = esc_html__('Events Calendar', 'total'); } /*-----------------------------------------------------------------------------------*/ /* - Create and return the breadcrumbs /*-----------------------------------------------------------------------------------*/ // Apply filters so developers can alter the trail $trail = apply_filters('wpex_breadcrumbs_trail', $trail); // Return trail if ($trail && is_array($trail)) { $classes = 'site-breadcrumbs wpex-clr'; $classes .= ' position-' . wpex_get_mod('breadcrumbs_position', 'default'); // Open Breadcrumbs $breadcrumb = '<nav class="' . $classes . '"><div class="breadcrumb-trail">'; // Separator HTML $separator = '<span class="sep"> ' . $separator . ' </span>'; // Join all trail items into a string $breadcrumb .= implode($separator, $trail); // Close breadcrumbs $breadcrumb .= '</div></nav>'; } // Update output var $this->output = $breadcrumb; }
/** * Fetch and return required events. * @param array $atts shortcode attributes * @return string shortcode output */ public function ecs_fetch_events($atts) { /** * Check if events calendar plugin method exists */ if (!function_exists('tribe_get_events')) { return; } global $wp_query, $post; $output = ''; $ecs_event_tax = ''; extract(shortcode_atts(array('cat' => '', 'month' => '', 'limit' => 5, 'eventdetails' => 'true', 'time' => null, 'past' => null, 'venue' => 'false', 'author' => null, 'message' => 'There are no upcoming events at this time.', 'key' => 'End Date', 'order' => 'ASC', 'viewall' => 'false', 'excerpt' => 'false', 'thumb' => 'false', 'thumbwidth' => '', 'thumbheight' => '', 'contentorder' => 'title, thumbnail, excerpt, date, venue'), $atts, 'ecs-list-events'), EXTR_PREFIX_ALL, 'ecs'); // Category if ($ecs_cat) { $ecs_cats = explode(",", $ecs_cat); $ecs_cats = array_map('trim', $ecs_cats); $ecs_event_tax = array(array('taxonomy' => 'tribe_events_cat', 'field' => 'slug', 'terms' => $ecs_cat)); } // Past Event $meta_date_compare = '>='; $meta_date_date = date('Y-m-d'); if ($ecs_time == 'past' || !empty($ecs_past)) { $meta_date_compare = '<'; } // Key if (str_replace(' ', '', trim(strtolower($ecs_key))) == 'startdate') { $ecs_key = '_EventStartDate'; } else { $ecs_key = '_EventEndDate'; } // Date $ecs_meta_date = array(array('key' => $ecs_key, 'value' => $meta_date_date, 'compare' => $meta_date_compare, 'type' => 'DATETIME')); // Specific Month if ($ecs_month == 'current') { $ecs_month = date('Y-m'); } if ($ecs_month) { $month_array = explode("-", $ecs_month); $month_yearstr = $month_array[0]; $month_monthstr = $month_array[1]; $month_startdate = date($month_yearstr . "-" . $month_monthstr . "-1"); $month_enddate = date($month_yearstr . "-" . $month_monthstr . "-t"); $ecs_meta_date = array(array('key' => $ecs_key, 'value' => array($month_startdate, $month_enddate), 'compare' => 'BETWEEN', 'type' => 'DATETIME')); } $posts = get_posts(array('post_type' => 'tribe_events', 'posts_per_page' => $ecs_limit, 'tax_query' => $ecs_event_tax, 'meta_key' => $ecs_key, 'orderby' => 'meta_value', 'author' => $ecs_author, 'order' => $ecs_order, 'meta_query' => array($ecs_meta_date))); if ($posts) { $output .= '<ul class="ecs-event-list">'; $ecs_contentorder = explode(',', $ecs_contentorder); foreach ($posts as $post) { setup_postdata($post); $output .= '<li class="ecs-event">'; // Put Values into $output foreach ($ecs_contentorder as $contentorder) { switch (trim($contentorder)) { case 'title': $output .= '<h4 class="entry-title summary">' . '<a href="' . tribe_get_event_link() . '" rel="bookmark">' . get_the_title() . '</a> </h4>'; break; case 'thumbnail': if (self::isValid($ecs_thumb)) { $thumbWidth = is_numeric($ecs_thumbwidth) ? $ecs_thumbwidth : ''; $thumbHeight = is_numeric($ecs_thumbheight) ? $ecs_thumbheight : ''; if (!empty($thumbWidth) && !empty($thumbHeight)) { $output .= get_the_post_thumbnail(get_the_ID(), array($thumbWidth, $thumbHeight)); } else { $output .= get_the_post_thumbnail(get_the_ID(), 'medium'); } } break; case 'excerpt': if (self::isValid($ecs_excerpt)) { $excerptLength = is_numeric($ecs_excerpt) ? $ecs_excerpt : 100; $output .= '<p class="ecs-excerpt">' . self::get_excerpt($excerptLength) . '</p>'; } break; case 'date': if (self::isValid($ecs_eventdetails)) { $output .= '<span class="duration time">' . tribe_events_event_schedule_details() . '</span>'; } break; case 'venue': if (self::isValid($ecs_venue)) { $output .= '<span class="duration venue"><em> at </em>' . tribe_get_venue() . '</span>'; } break; } } $output .= '</li>'; } $output .= '</ul>'; if (self::isValid($ecs_viewall)) { $output .= '<span class="ecs-all-events"><a href="' . tribe_get_events_link() . '" rel="bookmark">' . translate('View All Events', 'tribe-events-calendar') . '</a></span>'; } } else { //No Events were Found $output .= translate($ecs_message, 'tribe-events-calendar'); } // endif wp_reset_query(); return $output; }
/** * Asset calls for vendor packages * * @param string $name * @param array $deps Dependents */ public static function asset_package($name, $deps = array()) { $tec = TribeEvents::instance(); $prefix = 'tribe-events'; // TribeEvents::POSTTYPE; // setup plugin resources & 3rd party vendor urls $resources_url = trailingslashit($tec->pluginUrl) . 'resources/'; $vendor_url = trailingslashit($tec->pluginUrl) . 'vendor/'; // @TODO make this more DRY switch ($name) { case 'jquery-resize': $path = self::getMinFile($vendor_url . 'jquery-resize/jquery.ba-resize.js', true); $deps = array_merge($deps, array('jquery')); wp_enqueue_script($prefix . '-jquery-resize', $path, $deps, '1.1', false); self::$vendor_scripts[] = $prefix . '-jquery-resize'; break; case 'chosen': // Vendor: jQuery Chosen $deps = array_merge($deps, array('jquery')); $css_path = self::getMinFile($vendor_url . 'chosen/public/chosen.css', true); $path = self::getMinFile($vendor_url . 'chosen/public/chosen.jquery.js', true); wp_enqueue_style($prefix . '-chosen-style', $css_path); wp_enqueue_script($prefix . '-chosen-jquery', $path, $deps, '0.9.5', false); self::$vendor_scripts[] = $prefix . '-chosen-jquery'; break; case 'smoothness': // Vendor: jQuery Custom Styles $path = self::getMinFile($vendor_url . 'jquery/smoothness/jquery-ui-1.8.23.custom.css', true); wp_enqueue_style($prefix . '-custom-jquery-styles', $path); break; case 'select2': // Vendor: Select2 $css_path = self::getMinFile($vendor_url . 'select2/select2.css', true); $path = self::getMinFile($vendor_url . 'select2/select2.js', true); wp_enqueue_style($prefix . '-select2-css', $css_path); wp_enqueue_script($prefix . '-select2', $path, 'jquery', '3.2'); self::$vendor_scripts[] = $prefix . '-select2'; break; case 'calendar-script': // Tribe Events JS $deps = array_merge($deps, array('jquery'), self::$vendor_scripts); $path = self::getMinFile($resources_url . 'tribe-events.js', true); wp_enqueue_script($prefix . '-calendar-script', $path, $deps, apply_filters('tribe_events_js_version', TribeEvents::VERSION)); $js_config_array = array('permalink_settings' => get_option('permalink_structure'), 'events_post_type' => TribeEvents::POSTTYPE, 'events_base' => tribe_get_events_link()); wp_localize_script($prefix . '-calendar-script', 'tribe_js_config', $js_config_array); break; case 'datepicker': // Vendor: jQuery Datepicker wp_enqueue_script('jquery-ui-datepicker'); wp_enqueue_style('jquery-ui-datepicker'); self::$vendor_scripts[] = 'jquery-ui-datepicker'; break; case 'bootstrap-datepicker': // Vendor: Bootstrap Datepicker $css_path = self::getMinFile($vendor_url . 'bootstrap-datepicker/css/datepicker.css', true); $path = self::getMinFile($vendor_url . 'bootstrap-datepicker/js/bootstrap-datepicker.js', true); wp_enqueue_style($prefix . '-bootstrap-datepicker-css', $css_path); wp_enqueue_script($prefix . '-bootstrap-datepicker', $path, 'jquery', '3.2'); self::$vendor_scripts[] = $prefix . '-bootstrap-datepicker'; $localized_datepicker_array = array('days' => array_merge($tec->daysOfWeek, array($tec->daysOfWeek[0])), 'daysShort' => array_merge($tec->daysOfWeekShort, array($tec->daysOfWeekShort[0])), 'daysMin' => array_merge($tec->daysOfWeekMin, array($tec->daysOfWeekMin[0])), 'months' => array_values($tec->monthsFull), 'monthsShort' => array_values($tec->monthsShort), 'clear' => 'Clear', 'today' => 'Today'); wp_localize_script($prefix . '-bootstrap-datepicker', 'tribe_bootstrap_datepicker_strings', array('dates' => $localized_datepicker_array)); break; case 'dialog': // Vendor: jQuery Dialog wp_enqueue_script('jquery-ui-dialog'); self::$vendor_scripts[] = 'jquery-ui-dialog'; break; case 'admin-ui': // Tribe Events $path = self::getMinFile($resources_url . 'events-admin.css', true); wp_enqueue_style($prefix . '-admin-ui', $path, array(), TribeEvents::VERSION); break; case 'admin': $deps = array_merge($deps, array('jquery', 'jquery-ui-datepicker')); $path = self::getMinFile($resources_url . 'events-admin.js', true); wp_enqueue_script($prefix . '-admin', $path, $deps, apply_filters('tribe_events_js_version', TribeEvents::VERSION), true); break; case 'settings': $deps = array_merge($deps, array('jquery')); $path = self::getMinFile($resources_url . 'tribe-settings.js', true); wp_enqueue_script($prefix . '-settings', $path, $deps, apply_filters('tribe_events_js_version', TribeEvents::VERSION), true); break; case 'ecp-plugins': $deps = array_merge($deps, array('jquery')); $path = self::getMinFile($resources_url . 'jquery-ecp-plugins.js', true); wp_enqueue_script($prefix . '-ecp-plugins', $path, $deps, apply_filters('tribe_events_js_version', TribeEvents::VERSION)); break; case 'tribe-events-bar': $deps = array_merge($deps, array('jquery', $prefix . '-calendar-script', $prefix . '-bootstrap-datepicker', $prefix . '-jquery-resize', self::get_placeholder_handle())); $path = self::getMinFile($resources_url . 'tribe-events-bar.js', true); wp_enqueue_script($prefix . '-bar', $path, $deps, apply_filters('tribe_events_js_version', TribeEvents::VERSION)); break; case 'jquery-placeholder': // Vendor: jQuery Placeholder $deps = array_merge($deps, array('jquery')); $path = self::getMinFile($vendor_url . 'jquery-placeholder/jquery.placeholder.js', true); $placeholder_handle = self::get_placeholder_handle(); wp_enqueue_script($placeholder_handle, $path, $deps, '2.0.7', false); self::$vendor_scripts[] = $placeholder_handle; break; case 'ajax-calendar': $deps = array_merge($deps, array('jquery', $prefix . '-bootstrap-datepicker', $prefix . '-calendar-script')); $ajax_data = array("ajaxurl" => admin_url('admin-ajax.php', is_ssl() ? 'https' : 'http')); $path = self::getMinFile($resources_url . 'tribe-events-ajax-calendar.js', true); wp_enqueue_script('tribe-events-calendar', $path, $deps, apply_filters('tribe_events_js_version', TribeEvents::VERSION), true); wp_localize_script('tribe-events-calendar', 'TribeCalendar', $ajax_data); break; case 'ajax-list': $deps = array_merge($deps, array('jquery', $prefix . '-calendar-script')); $tribe_paged = !empty($_REQUEST['tribe_paged']) ? $_REQUEST['tribe_paged'] : 0; $ajax_data = array("ajaxurl" => admin_url('admin-ajax.php', is_ssl() ? 'https' : 'http'), 'tribe_paged' => $tribe_paged); $path = self::getMinFile($resources_url . 'tribe-events-ajax-list.js', true); wp_enqueue_script('tribe-events-list', $path, $deps, apply_filters('tribe_events_js_version', TribeEvents::VERSION), true); wp_localize_script('tribe-events-list', 'TribeList', $ajax_data); break; case 'ajax-dayview': $ajax_data = array("ajaxurl" => admin_url('admin-ajax.php', is_ssl() ? 'https' : 'http'), 'post_type' => TribeEvents::POSTTYPE); $path = self::getMinFile($resources_url . 'tribe-events-ajax-day.js', true); wp_enqueue_script('tribe-events-ajax-day', $path, array('tribe-events-bar'), apply_filters('tribe_events_js_version', TribeEvents::VERSION), true); wp_localize_script('tribe-events-ajax-day', 'TribeCalendar', $ajax_data); break; case 'events-css': // check if responsive should be killed if (apply_filters('tribe_events_kill_responsive', false)) { add_filter('tribe_events_mobile_breakpoint', '__return_zero'); } $stylesheets = array(); $mobile_break = tribe_get_mobile_breakpoint(); // Get the selected style option $style_option = tribe_get_option('stylesheetOption', 'tribe'); // Determine the stylesheet files for the selected option switch ($style_option) { case 'skeleton': $stylesheets['tribe-events-calendar-style'] = 'tribe-events-skeleton.css'; break; case 'full': $stylesheets['tribe-events-calendar-style'] = 'tribe-events-full.css'; if ($mobile_break > 0) { $stylesheets['tribe-events-calendar-mobile-style'] = 'tribe-events-full-mobile.css'; } break; default: // tribe styles $stylesheets['tribe-events-full-calendar-style'] = 'tribe-events-full.css'; $stylesheets['tribe-events-calendar-style'] = 'tribe-events-theme.css'; if ($mobile_break > 0) { $stylesheets['tribe-events-calendar-full-mobile-style'] = 'tribe-events-full-mobile.css'; $stylesheets['tribe-events-calendar-mobile-style'] = 'tribe-events-theme-mobile.css'; } break; } // put override css at the end of the array $stylesheets['tribe-events-calendar-override-style'] = 'tribe-events/tribe-events.css'; // do the enqueues foreach ($stylesheets as $name => $css_file) { if ($name == 'tribe-events-calendar-override-style') { $user_stylesheet_url = TribeEventsTemplates::locate_stylesheet('tribe-events/tribe-events.css'); if ($user_stylesheet_url) { wp_enqueue_style($name, $user_stylesheet_url); } } else { // get full URL $url = tribe_events_resource_url($css_file); // get the minified file $url = self::getMinFile($url, true); // apply filters $url = apply_filters('tribe_events_stylesheet_url', $url, $name); // set the $media attribute if ($name == 'tribe-events-calendar-mobile-style' || $name == 'tribe-events-calendar-full-mobile-style') { $media = "only screen and (max-width: {$mobile_break}px)"; wp_enqueue_style($name, $url, array('tribe-events-calendar-style'), TribeEvents::VERSION, $media); } else { wp_register_style($name, $url, array(), TribeEvents::VERSION); wp_enqueue_style($name); } } } break; default: do_action($prefix . '-' . $name); break; } }
function avia_events_breadcrumb($trail) { global $avia_config; if (isset($avia_config['currently_viewing']) && $avia_config['currently_viewing'] == 'events' || tribe_is_month() || get_post_type() === TribeEvents::POSTTYPE || is_tax(TribeEvents::TAXONOMY)) { $events = __('Events', 'avia_framework'); $events_link = '<a href="' . tribe_get_events_link() . '">' . $events . '</a>'; if (is_tax(TribeEvents::TAXONOMY)) { $last = array_pop($trail); $trail[] = $events_link; $trail[] = $last; } else { if (tribe_is_month() || tribe_is_upcoming() && !is_singular()) { $trail[] = $events_link; } else { if (tribe_is_event()) { $last = array_pop($trail); $trail[] = $events_link; $trail[] = $last; } } } if (isset($avia_config['events_trail'])) { $trail = $avia_config['events_trail']; } } return $trail; }
/** * Fetch and return required events. * @param array $atts shortcode attributes * @return string shortcode output */ public function ecs_fetch_events($atts) { /** * Check if events calendar plugin method exists */ if (!function_exists('tribe_get_events')) { return; } global $wp_query, $post; $output = ''; $atts = shortcode_atts(array('cat' => '', 'month' => '', 'limit' => 5, 'eventdetails' => 'true', 'time' => null, 'past' => null, 'venue' => 'false', 'author' => null, 'message' => 'Não há nenhum curso para ser apresentado.', 'key' => 'End Date', 'order' => 'ASC', 'viewall' => 'false', 'excerpt' => '1500', 'thumb' => 'true', 'thumbwidth' => '366', 'thumbheight' => '264', 'contentorder' => 'title, thumbnail, excerpt, date, venue', 'event_tax' => ''), $atts, 'mople-list-cursos'); // Category if ($atts['cat']) { if (strpos($atts['cat'], ",") !== false) { $atts['cats'] = explode(",", $atts['cat']); $atts['cats'] = array_map('trim', $atts['cats']); } else { $atts['cats'] = $atts['cat']; } $atts['event_tax'] = array('relation' => 'OR', array('taxonomy' => 'tribe_events_cat', 'field' => 'name', 'terms' => $atts['cats']), array('taxonomy' => 'tribe_events_cat', 'field' => 'slug', 'terms' => $atts['cats'])); } // Past Event $meta_date_compare = '>='; $meta_date_date = date('Y-m-d'); if ($atts['time'] == 'past' || !empty($atts['past'])) { $meta_date_compare = '<'; } // Key if (str_replace(' ', '', trim(strtolower($atts['key']))) == 'startdate') { $atts['key'] = '_EventStartDate'; } else { $atts['key'] = '_EventEndDate'; } // Date $atts['meta_date'] = array(array('key' => $atts['key'], 'value' => $meta_date_date, 'compare' => $meta_date_compare, 'type' => 'DATETIME')); // Specific Month if ($atts['month'] == 'current') { $atts['month'] = date('Y-m'); } if ($atts['month']) { $month_array = explode("-", $atts['month']); $month_yearstr = $month_array[0]; $month_monthstr = $month_array[1]; $month_startdate = date($month_yearstr . "-" . $month_monthstr . "-1"); $month_enddate = date($month_yearstr . "-" . $month_monthstr . "-t"); $atts['meta_date'] = array(array('key' => $atts['key'], 'value' => array($month_startdate, $month_enddate), 'compare' => 'BETWEEN', 'type' => 'DATETIME')); } $posts = get_posts(array('post_type' => 'tribe_events', 'posts_per_page' => $atts['limit'], 'tax_query' => $atts['event_tax'], 'meta_key' => $atts['key'], 'orderby' => 'meta_value', 'author' => $atts['author'], 'order' => $atts['order'], 'meta_query' => array($atts['meta_date']))); if ($posts) { $output .= '<ul class="ecs-event-list">'; $atts['contentorder'] = explode(',', $atts['contentorder']); foreach ($posts as $post) { setup_postdata($post); $output .= '<li class="ecs-event">'; // Put Values into $output foreach ($atts['contentorder'] as $contentorder) { switch (trim($contentorder)) { case 'title': $moreInfo_Publico_Alvo = get_field("event_basicInfo_publico_alvo"); $moreInfo_Instrutor = get_field("event_basicInfo_instrutor"); $moreInfo_Duracao = get_field("event_basicInfo_duracao"); $output .= '<h4 class="entry-title summary">' . '<a href="' . tribe_get_event_link() . '" rel="bookmark">' . apply_filters('ecs_event_list_title', get_the_title(), $atts) . '</a> </h4>'; if ($moreInfo_Publico_Alvo) { $output .= '<div class="basicInfo publico_alvo"><p>Publico Alvo:</p><span> ' . $moreInfo_Publico_Alvo . '</span></div>'; } if ($moreInfo_Instrutor) { $output .= '<div class="basicInfo instrutor"><p>Instrutor: </p><span> ' . $moreInfo_Instrutor . '</span></div>'; } if ($moreInfo_Instrutor || $moreInfo_Duracao) { $output .= '<span class="basicInfo divider"> | </span>'; } if ($moreInfo_Duracao) { $output .= '<div class="basicInfo duracao"><p>Duracao:</p><span> ' . $moreInfo_Duracao . ' horas</span></div>'; } break; case 'thumbnail': if (self::isValid($atts['thumb'])) { $thumbWidth = is_numeric($atts['thumbwidth']) ? $atts['thumbwidth'] : ''; $thumbHeight = is_numeric($atts['thumbheight']) ? $atts['thumbheight'] : ''; if (!empty($thumbWidth) && !empty($thumbHeight)) { $output .= get_the_post_thumbnail(get_the_ID(), array($thumbWidth, $thumbHeight)); } else { $size = !empty($thumbWidth) && !empty($thumbHeight) ? array($thumbWidth, $thumbHeight) : 'medium'; if ($thumb = get_the_post_thumbnail(get_the_ID(), $size)) { $output .= '<a href="' . tribe_get_event_link() . '">'; $output .= $thumb; $output .= '</a>'; } } } break; case 'excerpt': if (self::isValid($atts['excerpt'])) { $excerptLength = is_numeric($atts['excerpt']) ? $atts['excerpt'] : 1500; //$moreInfo_date = get_field("event_moreInfo_date"); //$moreInfo_video = get_field("event_moreInfo_video"); $moreInfo_inscription = get_field("event_moreInfo_inscricao"); $moreInfo_download = get_field("event_moreInfo_baixar"); $output .= '<p class="ecs-excerpt">' . self::get_excerpt($excerptLength) . '</p>'; if ($moreInfo_inscription || $moreInfo_download) { $output .= '<div class="moreInfo"> <p>Saiba mais: </p>'; } if (self::isValid($atts['eventdetails'])) { //$output .= '<a class="icon date" href=""><img title="'.tribe_events_event_schedule_details().'" src="'.get_template_directory_uri().'/library/images/event_moreInfo/moreInfo_date.png"/></a>'; } /*if ($moreInfo_video) { $output .= '<a class="icon video" href="'.$moreInfo_video.'"><img src="'.get_template_directory_uri().'/library/images/event_moreInfo/moreInfo_video.png"/></a>'; }*/ if ($moreInfo_inscription) { $output .= '<a class="icon inscription" title="Inscricao" href="' . $moreInfo_inscription . '"><img src="' . get_template_directory_uri() . '/library/images/event_moreInfo/moreInfo_inscription.png"/></a>'; } if ($moreInfo_download) { $output .= '<a class="icon baixar" title="Baixar" href="' . $moreInfo_download . '" target="_blank"><img src="' . get_template_directory_uri() . '/library/images/event_moreInfo/moreInfo_download.png"/></a>'; } if ($moreInfo_inscription || $moreInfo_download) { $output .= '</div>'; } } break; /*case 'more_info' : if( self::isValid($atts['more_info']) ) { $output .= '<div class="moreInfo">' .the_field(event_moreInfo_inscricao). '</div>'; } break;*/ /*case 'more_info' : if( self::isValid($atts['more_info']) ) { $output .= '<div class="moreInfo">' .the_field(event_moreInfo_inscricao). '</div>'; } break;*/ case 'venue': if (self::isValid($atts['venue'])) { $output .= '<span class="duration venue"><em> at </em>' . apply_filters('ecs_event_list_venue', tribe_get_venue(), $atts) . '</span>'; } break; } } $output .= '</li>'; } $output .= '</ul>'; if (self::isValid($atts['viewall'])) { $output .= '<span class="ecs-all-events"><a href="' . apply_filters('ecs_event_list_viewall_link', tribe_get_events_link(), $atts) . '" rel="bookmark">' . translate('View All Events', 'tribe-events-calendar') . '</a></span>'; } } else { //No Events were Found $output .= translate($atts['message'], 'tribe-events-calendar'); } // endif wp_reset_query(); return $output; }
/** * Sets the page title for the various PRO views. * * @param string $title The current title. * * @return string The modified title. */ function reset_page_title($title, $depth = true) { global $wp_query; $tec = TribeEvents::instance(); $date_format = apply_filters('tribe_events_pro_page_title_date_format', tribe_get_date_format(true)); if (tribe_is_showing_all()) { $reset_title = sprintf('%s %s', __('All events for', 'tribe-events-calendar-pro'), get_the_title()); } // week view title if (tribe_is_week()) { $reset_title = sprintf(__('Events for week of %s', 'tribe-events-calendar-pro'), date_i18n($date_format, strtotime(tribe_get_first_week_day($wp_query->get('start_date'))))); } if (!empty($reset_title) && is_tax($tec->get_event_taxonomy()) && $depth) { $cat = get_queried_object(); $reset_title = '<a href="' . tribe_get_events_link() . '">' . $reset_title . '</a>'; $reset_title .= ' › ' . $cat->name; } return isset($reset_title) ? apply_filters('tribe_template_factory_debug', $reset_title, 'tribe_get_events_title') : $title; }
/** * 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 = 'widgets/list-widget') { 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); // 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]); } } // extracting $instance provides $title, $limit $title = apply_filters('widget_title', $title); if (!isset($category) || $category === '-1') { $category = 0; } // Link to the main events page (should work even if month/list views are disabled) $event_url = tribe_get_events_link(); 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; do_action('tribe_events_before_list_widget'); do_action('tribe_events_list_widget_before_the_title'); /* Title of widget (before and after defined by themes). */ echo $title ? $before_title . $title . $after_title : ''; do_action('tribe_events_list_widget_after_the_title'); if ($posts) { /* Display list of events. */ echo '<ol class="hfeed vcalendar">'; foreach ($posts as $post) { setup_postdata($post); tribe_get_template_part($template_name); } echo "</ol><!-- .hfeed -->"; /* Display link to all events */ echo '<p class="tribe-events-widget-link"><a href="' . $event_url . '" rel="bookmark">'; if (empty($category)) { _e('View All Events', 'tribe-events-calendar'); } else { _e('View All Events in Category', 'tribe-events-calendar'); } echo '</a></p>'; } else { echo '<p>' . __('There are no upcoming events at this time.', 'tribe-events-calendar') . '</p>'; } do_action('tribe_events_after_list_widget'); /* After widget (defined by themes). */ 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; } } }
<?php $displayPressTrendsDialogue = tribe_get_option('displayedPressTrendsDialogue', false); $displayPressTrendsDialogueValue = $displayPressTrendsDialogue == false ? '1' : '0'; if ($displayPressTrendsDialogue == false) { tribe_update_option('displayedPressTrendsDialogue', true); } $generalTab = array('priority' => 10, 'fields' => apply_filters('tribe_general_settings_tab_fields', array('info-start' => array('type' => 'html', 'html' => '<div id="modern-tribe-info"><img src="' . plugins_url('resources/images/modern-tribe.png', dirname(__FILE__)) . '" alt="Modern Tribe Inc." title="Modern Tribe Inc.">'), 'upsell-heading' => array('type' => 'heading', 'label' => __('Finding & extending your calendar.', 'tribe-events-calendar'), 'conditional' => !defined('TRIBE_HIDE_UPSELL') || !TRIBE_HIDE_UPSELL), 'finding-heading' => array('type' => 'heading', 'label' => __('Finding your calendar.', 'tribe-events-calendar'), 'conditional' => defined('TRIBE_HIDE_UPSELL') && TRIBE_HIDE_UPSELL), 'view-calendar-link' => array('type' => 'html', 'html' => '<p>' . __('Where\'s my calendar?', 'tribe-events-calendar') . '<br /><a href="' . TribeEvents::getLink() . '">' . __('Right here', 'tribe-events-calendar') . '</a>.</p>'), 'upsell-info' => array('type' => 'html', 'html' => '<p>' . __('Looking for additional functionality including recurring events, custom meta, community events, ticket sales and more?', 'tribe-events-calendar') . '<br><a href="' . self::$tribeUrl . 'shop/?utm_source=generaltab&utm_medium=promolink&utm_campaign=plugin' . '">' . __('Check out the available Add-Ons', 'tribe-events-calendar') . '</a>.</p>', 'conditional' => !defined('TRIBE_HIDE_UPSELL') || !TRIBE_HIDE_UPSELL), 'donate-link-heading' => array('type' => 'heading', 'label' => __('We hope our plugin is helping you out.', 'tribe-events-calendar')), 'donate-link-info' => array('type' => 'html', 'html' => '<p>' . __('Are you thinking "Wow, this plugin is amazing! I should say thanks to Modern Tribe for all their hard work." The greatest thanks we could ask for is recognition. Add a small text only link at the bottom of your calendar pointing to The Events Calendar project.', 'tribe-events-calendar') . '<br><a href="' . plugins_url('resources/images/donate-link-screenshot.jpg', dirname(__FILE__)) . '" class="thickbox">' . __('See an example of the link', 'tribe-events-calendar') . '</a>.</p>', 'conditional' => !class_exists('TribeEventsPro')), 'donate-link-pro-info' => array('type' => 'html', 'html' => '<p>' . __('Are you thinking "Wow, this plugin is amazing! I should say thanks to Modern Tribe for all their hard work." The greatest thanks we could ask for is recognition. Add a small text only link at the bottom of your calendar pointing to The Events Calendar project.', 'tribe-events-calendar') . '<br><a href="' . plugins_url('resources/images/donate-link-pro-screenshot.jpg', dirname(__FILE__)) . '" class="thickbox">' . __('See an example of the link', 'tribe-events-calendar') . '</a>.</p>', 'conditional' => class_exists('TribeEventsPro')), 'donate-link' => array('type' => 'checkbox_bool', 'label' => __('Show Events Calendar Link', 'tribe-events-calendar'), 'default' => false, 'validation_type' => 'boolean'), 'info-end' => array('type' => 'html', 'html' => '</div>'), 'viewOption' => array('type' => 'radio', 'label' => __('Default view for the Events', 'tribe-events-calendar'), 'default' => 'month', 'options' => array('month' => 'Calendar', 'upcoming' => 'Event List'), 'validation_type' => 'options'), 'unprettyPermalinksUrl' => array('type' => 'html', 'label' => __('Events URL slug', 'tribe-events-calendar'), 'html' => '<p class="tribe-field-indent tribe-field-description description">' . __('You cannot edit the slug for your events page as you do not have pretty permalinks enabled. The current URL for your events page is <a href=" ' . TribeEvents::getLink('home') . '">' . TribeEvents::getLink('home ') . '</a>. In order to edit the slug here, enable pretty permalinks.', 'tribe-events-calendar') . '</p>', 'conditional' => '' == get_option('permalink_structure')), 'eventsSlug' => array('type' => 'text', 'label' => __('Events URL slug', 'tribe-events-calendar'), 'default' => 'events', 'validation_type' => 'slug', 'conditional' => '' != get_option('permalink_structure')), 'current-events-slug' => array('type' => 'html', 'html' => '<p class="tribe-field-indent tribe-field-description description">' . __('The slug used for building the events URL.', 'tribe-events-calendar') . sprintf(__('Your current Events URL is %s', 'tribe-events-calendar'), '<code><a href="' . tribe_get_events_link() . '">' . tribe_get_events_link() . '</a></code>') . '</p>', 'conditional' => '' != get_option('permalink_structure')), 'ical-info' => array('type' => 'html', 'display_callback' => function_exists('tribe_get_ical_link') ? '<p id="ical-link" class="tribe-field-indent tribe-field-description description">' . __('Here is the iCal feed URL for your events:', 'tribe-events-calendar') . ' ' . '<code>' . tribe_get_ical_link() . '</code></p>' : '', 'conditional' => function_exists('tribe_get_ical_link')), 'singleEventSlug' => array('type' => 'text', 'label' => __('Single Event URL slug', 'tribe-events-calendar'), 'default' => 'event', 'validation_type' => 'slug', 'conditional' => '' != get_option('permalink_structure')), 'current-single-event-slug' => array('type' => 'html', 'html' => '<p class="tribe-field-indent tribe-field-description description">' . sprintf(__('You <strong>cannot</strong> use the same slug as above. The above should ideally be plural, and this singular.<br />Your single Event URL is like: %s', 'tribe-events-calendar'), '<code>' . trailingslashit(home_url()) . tribe_get_option('singleEventSlug', 'event') . '/single-post-name/' . '</code>') . '</p>', 'conditional' => '' != get_option('permalink_structure')), 'postsPerPage' => array('type' => 'text', 'label' => __('Number of events to show per page', 'tribe-events-calendar'), 'size' => 'small', 'default' => get_option('posts_per_page'), 'validation_type' => 'positive_int'), 'showComments' => array('type' => 'checkbox_bool', 'label' => __('Show Comments', 'tribe-events-calendar'), 'tooltip' => __('Enable commenting on an event.', 'tribe-events-calendar'), 'default' => false, 'validation_type' => 'boolean'), 'multiDayCutoff' => array('type' => 'dropdown', 'label' => __('Multiday Event Cutoff', 'tribe-events-calendar'), 'tooltip' => __('Hide final day from grid view if multi-day event ends before this time.', 'tribe-events-calendar'), 'validation_type' => 'options', 'size' => 'small', 'default' => '12:00', 'options' => array('12:00' => '12:00 am', '12:30' => '12:30 am', '01:00' => '01:00 am', '01:30' => '01:30 am', '02:00' => '02:00 am', '02:30' => '02:30 am', '03:00' => '03:00 am', '03:30' => '03:30 am', '04:00' => '04:00 am', '04:30' => '04:30 am', '05:00' => '05:00 am', '05:30' => '05:30 am', '06:00' => '06:00 am', '06:30' => '06:30 am', '07:00' => '07:00 am', '07:30' => '07:30 am', '08:00' => '08:00 am', '08:30' => '08:30 am', '09:00' => '09:00 am', '09:30' => '09:30 am', '10:00' => '10:00 am', '10:30' => '10:30 am', '11:00' => '11:00 am', '11:30' => '11:30 am')), 'embedGoogleMaps' => array('type' => 'checkbox_bool', 'label' => __('Enable Google Maps', 'tribe-events-calendar'), 'tooltip' => __('Turn on to enable backend map preview and frontend map.', 'tribe-events-calendar'), 'default' => true, 'class' => 'google-embed-size', 'validation_type' => 'boolean'), 'embedGoogleMapsHeight' => array('type' => 'text', 'label' => __('Google Maps Embed Height', 'tribe-events-calendar'), 'size' => 'small', 'default' => 350, 'tooltip' => __('Enter a number.', 'tribe-events-calendar'), 'class' => 'google-embed-field', 'validation_type' => 'positive_int'), 'embedGoogleMapsWidth' => array('type' => 'text', 'label' => __('Google Maps Embed Width', 'tribe-events-calendar'), 'size' => 'small', 'tooltip' => __('Enter a number or %.', 'tribe-events-calendar'), 'default' => '100%', 'class' => 'google-embed-field', 'validation_type' => 'number_or_percent'), 'embedGoogleMapsZoom' => array('type' => 'text', 'label' => __('Google Maps Default Zoom Level', 'tribe-events-calendar'), 'tooltip' => __('0 = zoomed out; 21 = zoomed in.', 'tribe_events_calendar'), 'size' => 'small', 'default' => 10, 'class' => 'google-embed-field', 'validation_type' => 'number_or_percent'), 'sendPressTrendsData' => array('type' => 'checkbox_bool', 'label' => __('Send PressTrends Data', 'tribe-events-calendar'), 'tooltip' => __('Help us out by sending analytics data about your usage of The Events Calendar.', 'tribe-events-calendar'), 'default' => false, 'validation_type' => 'boolean'), 'debugEvents' => array('type' => 'checkbox_bool', 'label' => __('Debug Mode', 'tribe-events-calendar'), 'tooltip' => sprintf(__('Enable this option to log debug information. By default this will log to your server PHP error log. If you\'d like to see the log messages in your browser, then we recommend that you install the %s and look for the "Tribe" tab in the debug output.', 'tribe-events-calendar'), '<a href="http://wordpress.org/extend/plugins/debug-bar/" target="_blank">' . __('Debug Bar Plugin', 'tribe-events-calendar') . '</a>'), 'default' => false, 'validation_type' => 'boolean'), 'maybeDisplayPressTrendsDialogue' => array('type' => 'html', 'html' => '<input type="hidden" name="maybeDisplayPressTrendsDialogue" value="' . $displayPressTrendsDialogueValue . '"></input>'), 'pressTrendsDialogue' => array('type' => 'html', 'html' => '<div id="presstrends-dialog" title="Send PressTrends Data" style="display: none;">' . __('Would you like to help us out and send analytics about your usage of The Events Calendar?', 'tribe-events-calendar') . '<br/></div>'))));
<?php $tec = Tribe__Events__Main::instance(); $general_tab_fields = Tribe__Main::array_insert_after_key('info-start', $general_tab_fields, array('upsell-heading' => array('type' => 'heading', 'label' => esc_html__('Finding & extending your calendar.', 'the-events-calendar'), 'conditional' => !defined('TRIBE_HIDE_UPSELL') || !TRIBE_HIDE_UPSELL), 'finding-heading' => array('type' => 'heading', 'label' => esc_html__('Finding your calendar.', 'the-events-calendar'), 'conditional' => defined('TRIBE_HIDE_UPSELL') && TRIBE_HIDE_UPSELL), 'view-calendar-link' => array('type' => 'html', 'html' => '<p>' . esc_html__('Where\'s my calendar?', 'the-events-calendar') . ' <a href="' . esc_url(Tribe__Events__Main::instance()->getLink()) . '">' . esc_html__('Right here', 'the-events-calendar') . '</a>.</p>'))); $general_tab_fields = Tribe__Main::array_insert_before_key('debugEvents', $general_tab_fields, array('tribeEventsDisplayThemeTitle' => array('type' => 'html', 'html' => '<h3>' . esc_html__('General Settings', 'the-events-calendar') . '</h3>'), 'postsPerPage' => array('type' => 'text', 'label' => esc_html__('Number of events to show per page', 'the-events-calendar'), 'size' => 'small', 'default' => get_option('posts_per_page'), 'validation_type' => 'positive_int'), 'liveFiltersUpdate' => array('type' => 'checkbox_bool', 'label' => esc_html__('Use Javascript to control date filtering', 'the-events-calendar'), 'tooltip' => tribe_get_option('tribeDisableTribeBar', false) == true ? esc_html__('This option is disabled when "Disable the Event Search Bar" is checked on the Display settings tab.', 'the-events-calendar') : esc_html__('Enable live ajax for datepicker on front end (User submit not required).', 'the-events-calendar'), 'attributes' => tribe_get_option('tribeDisableTribeBar', false) == true ? array('disabled' => 'disabled') : null, 'default' => true, 'validation_type' => 'boolean', 'class' => tribe_get_option('tribeDisableTribeBar', false) == true ? 'tribe-fieldset-disabled' : null), 'showComments' => array('type' => 'checkbox_bool', 'label' => esc_html__('Show comments', 'the-events-calendar'), 'tooltip' => esc_html__('Enable comments on event pages.', 'the-events-calendar'), 'default' => false, 'validation_type' => 'boolean'), 'showEventsInMainLoop' => array('type' => 'checkbox_bool', 'label' => esc_html__('Include events in main blog loop', 'the-events-calendar'), 'tooltip' => esc_html__('Show events with the site\'s other posts. When this box is checked, events will also continue to appear on the default events page.', 'the-events-calendar'), 'default' => false, 'validation_type' => 'boolean'), 'unprettyPermalinksUrl' => array('type' => 'html', 'label' => esc_html__('Events URL slug', 'the-events-calendar'), 'html' => '<p>' . sprintf(__('You cannot edit the slug for your events page as you do not have pretty permalinks enabled. The current URL for your events page is <a href="%1$s">%2$s</a>. In order to edit the slug here, <a href="%3$soptions-permalink.php">enable pretty permalinks</a>.', 'the-events-calendar'), esc_url($tec->getLink('home')), $tec->getLink('home '), esc_url(trailingslashit(get_admin_url()))) . '</p>', 'conditional' => '' == get_option('permalink_structure')), 'eventsSlug' => array('type' => 'text', 'label' => esc_html__('Events URL slug', 'the-events-calendar'), 'default' => 'events', 'validation_type' => 'slug', 'conditional' => '' != get_option('permalink_structure')), 'current-events-slug' => array('type' => 'html', 'html' => '<p class="tribe-field-indent tribe-field-description description">' . esc_html__('The slug used for building the events URL.', 'the-events-calendar') . sprintf(esc_html__('Your current events URL is: %s', 'the-events-calendar'), '<code><a href="' . esc_url(tribe_get_events_link()) . '">' . tribe_get_events_link() . '</a></code>') . '</p>', 'conditional' => '' != get_option('permalink_structure')), 'ical-info' => array('type' => 'html', 'display_callback' => function_exists('tribe_get_ical_link') ? '<p id="ical-link" class="tribe-field-indent tribe-field-description description">' . esc_html__('Here is the iCal feed URL for your events:', 'the-events-calendar') . ' <code>' . tribe_get_ical_link() . '</code></p>' : '', 'conditional' => function_exists('tribe_get_ical_link')), 'singleEventSlug' => array('type' => 'text', 'label' => esc_html__('Single event URL slug', 'the-events-calendar'), 'default' => 'event', 'validation_type' => 'slug', 'conditional' => '' != get_option('permalink_structure')), 'current-single-event-slug' => array('type' => 'html', 'html' => '<p class="tribe-field-indent tribe-field-description description">' . sprintf(__('The above should ideally be plural, and this singular.<br />Your single event URL is: %s', 'the-events-calendar'), '<code>' . trailingslashit(home_url()) . tribe_get_option('singleEventSlug', 'event') . '/single-post-name/</code>') . '</p>', 'conditional' => '' != get_option('permalink_structure')), 'multiDayCutoff' => array('type' => 'dropdown', 'label' => esc_html__('End of day cutoff', 'the-events-calendar'), 'validation_type' => 'options', 'size' => 'small', 'default' => '12:00', 'options' => array('00:00' => '12:00 am', '01:00' => '01:00 am', '02:00' => '02:00 am', '03:00' => '03:00 am', '04:00' => '04:00 am', '05:00' => '05:00 am', '06:00' => '06:00 am', '07:00' => '07:00 am', '08:00' => '08:00 am', '09:00' => '09:00 am', '10:00' => '10:00 am', '11:00' => '11:00 am')), 'multiDayCutoffHelper' => array('type' => 'html', 'html' => '<p class="tribe-field-indent tribe-field-description description">' . sprintf(esc_html__("Have an event that runs past midnight? Select a time after that event's end to avoid showing the event on the next day's calendar.", 'the-events-calendar')) . '</p>', 'conditional' => '' != get_option('permalink_structure')), 'defaultCurrencySymbol' => array('type' => 'text', 'label' => esc_html__('Default currency symbol', 'the-events-calendar'), 'tooltip' => esc_html__('Set the default currency symbol for event costs. Note that this only impacts future events, and changes made will not apply retroactively.', 'the-events-calendar'), 'validation_type' => 'textarea', 'size' => 'small', 'default' => '$'), 'reverseCurrencyPosition' => array('type' => 'checkbox_bool', 'label' => esc_html__('Currency symbol follows value', 'the-events-calendar'), 'tooltip' => esc_html__('The currency symbol normally precedes the value. Enabling this option positions the symbol after the value.', 'the-events-calendar'), 'default' => false, 'validation_type' => 'boolean'), 'amalgamateDuplicates' => array('type' => 'html', 'html' => '<fieldset class="tribe-field tribe-field-html"><legend>' . esc_html__('Duplicate Venues & Organizers', 'the-events-calendar') . '</legend><div class="tribe-field-wrap">' . Tribe__Events__Amalgamator::migration_button(esc_html__('Merge Duplicates', 'the-events-calendar')) . '<p class="tribe-field-indent description">' . esc_html__('You might find duplicate venues and organizers when updating The Events Calendar from a pre-3.0 version. Click this button to automatically merge identical venues and organizers.', 'the-events-calendar') . '</p></div></fieldset><div class="clear"></div>', 'conditional' => Tribe__Settings_Manager::get_option('organizer_venue_amalgamation', 0) < 1), 'tribeEventsMiscellaneousTitle' => array('type' => 'html', 'html' => '<h3>' . esc_html__('Miscellaneous Settings', 'the-events-calendar') . '</h3>'))); $general_tab_fields = Tribe__Main::array_insert_after_key('tribeEventsMiscellaneousTitle', $general_tab_fields, array('viewWelcomePage' => array('type' => 'html', 'html' => '<fieldset class="tribe-field tribe-field-html"><legend>' . esc_html__('View Welcome Page', 'the-events-calendar') . '</legend><div class="tribe-field-wrap"><a href="' . Tribe__Settings::instance()->get_url(array(Tribe__Events__Main::instance()->activation_page->welcome_slug => 1)) . '" class="button">' . esc_html__('View Welcome Page', 'the-events-calendar') . '</a><p class="tribe-field-indent description">' . esc_html__('View the page that displayed when you initially installed the plugin.', 'the-events-calendar') . '</p></div></fieldset><div class="clear"></div>'), 'viewUpdatePage' => array('type' => 'html', 'html' => '<fieldset class="tribe-field tribe-field-html"><legend>' . esc_html__('View Update Page', 'the-events-calendar') . '</legend><div class="tribe-field-wrap"><a href="' . Tribe__Settings::instance()->get_url(array(Tribe__Events__Main::instance()->activation_page->update_slug => 1)) . '" class="button">' . esc_html__('View Update Page', 'the-events-calendar') . '</a><p class="tribe-field-indent description">' . esc_html__('View the page that displayed when you updated the plugin.', 'the-events-calendar') . '</p></div></fieldset><div class="clear"></div>'))); $general_tab_fields = Tribe__Main::array_insert_before_key('tribeEventsMiscellaneousTitle', $general_tab_fields, array('tribeEventsDisplayTitle' => array('type' => 'html', 'html' => '<h3>' . esc_html__('Map Settings', 'the-events-calendar') . '</h3>'), 'embedGoogleMaps' => array('type' => 'checkbox_bool', 'label' => esc_html__('Enable Google Maps', 'the-events-calendar'), 'tooltip' => esc_html__('Check to enable maps for events and venues.', 'the-events-calendar'), 'default' => true, 'class' => 'google-embed-size', 'validation_type' => 'boolean'), 'embedGoogleMapsZoom' => array('type' => 'text', 'label' => esc_html__('Google Maps default zoom level', 'the-events-calendar'), 'tooltip' => esc_html__('0 = zoomed out; 21 = zoomed in.', 'the-events-calendar'), 'size' => 'small', 'default' => 10, 'class' => 'google-embed-field', 'validation_type' => 'number_or_percent'))); return $general_tab_fields;
/** * 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 .= ' › ' . $cat->name; } return apply_filters('tribe_get_events_title', $title, $depth); }
<?php $tec = TribeEvents::instance(); $generalTab = array('priority' => 10, 'fields' => apply_filters('tribe_general_settings_tab_fields', array('info-start' => array('type' => 'html', 'html' => '<div id="modern-tribe-info"><img src="' . plugins_url('resources/images/modern-tribe@2x.png', dirname(__FILE__)) . '" alt="Modern Tribe Inc." title="Modern Tribe Inc.">'), 'upsell-heading' => array('type' => 'heading', 'label' => __('Finding & extending your calendar.', 'tribe-events-calendar'), 'conditional' => !defined('TRIBE_HIDE_UPSELL') || !TRIBE_HIDE_UPSELL), 'finding-heading' => array('type' => 'heading', 'label' => __('Finding your calendar.', 'tribe-events-calendar'), 'conditional' => defined('TRIBE_HIDE_UPSELL') && TRIBE_HIDE_UPSELL), 'view-calendar-link' => array('type' => 'html', 'html' => '<p>' . __('Where\'s my calendar?', 'tribe-events-calendar') . ' <a href="' . TribeEvents::getLink() . '">' . __('Right here', 'tribe-events-calendar') . '</a>.</p>'), 'upsell-info' => array('type' => 'html', 'html' => '<p>' . __('Looking for additional functionality including recurring events, custom meta, community events, ticket sales and more?', 'tribe-events-calendar') . ' <a href="' . self::$tribeUrl . 'products/?utm_source=generaltab&utm_medium=plugin-tec&utm_campaign=in-app' . '">' . __('Check out the available add-ons', 'tribe-events-calendar') . '</a>.</p>', 'conditional' => !defined('TRIBE_HIDE_UPSELL') || !TRIBE_HIDE_UPSELL), 'donate-link-heading' => array('type' => 'heading', 'label' => __('We hope our plugin is helping you out.', 'tribe-events-calendar')), 'donate-link-info' => array('type' => 'html', 'html' => '<p>' . __('Are you thinking "Wow, this plugin is amazing! I should say thanks to Modern Tribe for all their hard work." The greatest thanks we could ask for is recognition. Add a small text-only link at the bottom of your calendar pointing to The Events Calendar project.', 'tribe-events-calendar') . '<br><a href="' . plugins_url('resources/images/donate-link-screenshot.jpg', dirname(__FILE__)) . '" class="thickbox">' . __('See an example of the link', 'tribe-events-calendar') . '</a>.</p>', 'conditional' => !class_exists('TribeEventsPro')), 'donate-link-pro-info' => array('type' => 'html', 'html' => '<p>' . __('Are you thinking "Wow, this plugin is amazing! I should say thanks to Modern Tribe for all their hard work." The greatest thanks we could ask for is recognition. Add a small text only link at the bottom of your calendar pointing to The Events Calendar project.', 'tribe-events-calendar') . '<br><a href="' . plugins_url('resources/images/donate-link-pro-screenshot.jpg', dirname(__FILE__)) . '" class="thickbox">' . __('See an example of the link', 'tribe-events-calendar') . '</a>.</p>', 'conditional' => class_exists('TribeEventsPro')), 'donate-link' => array('type' => 'checkbox_bool', 'label' => __('Show The Events Calendar link', 'tribe-events-calendar'), 'default' => false, 'validation_type' => 'boolean'), 'info-end' => array('type' => 'html', 'html' => '</div>'), 'tribe-form-content-start' => array('type' => 'html', 'html' => '<div class="tribe-settings-form-wrap">'), 'tribeEventsDisplayThemeTitle' => array('type' => 'html', 'html' => '<h3>' . __('General Settings', 'tribe-events-calendar') . '</h3>'), 'postsPerPage' => array('type' => 'text', 'label' => __('Number of events to show per page', 'tribe-events-calendar'), 'size' => 'small', 'default' => get_option('posts_per_page'), 'validation_type' => 'positive_int'), 'liveFiltersUpdate' => array('type' => 'checkbox_bool', 'label' => __('Use Javascript to control page load', 'tribe-events-calendar'), 'tooltip' => __('Enable ajax to live refresh content.', 'tribe-events-calendar'), 'default' => true, 'validation_type' => 'boolean'), 'showComments' => array('type' => 'checkbox_bool', 'label' => __('Show comments', 'tribe-events-calendar'), 'tooltip' => __('Enable comments on event pages.', 'tribe-events-calendar'), 'default' => false, 'validation_type' => 'boolean'), 'showEventsInMainLoop' => array('type' => 'checkbox_bool', 'label' => __('Include events in main blog loop', 'tribe-events-calendar'), 'tooltip' => __('Show events with the site\'s other posts. When this box is checked, events will also continue to appear on the default events page.', 'tribe-events-calendar'), 'default' => false, 'validation_type' => 'boolean'), 'unprettyPermalinksUrl' => array('type' => 'html', 'label' => __('Events URL slug', 'tribe-events-calendar'), 'html' => '<p>' . sprintf(__('You cannot edit the slug for your events page as you do not have pretty permalinks enabled. The current URL for your events page is <a href="%s">%s</a>. In order to edit the slug here, <a href="%soptions-permalink.php">enable pretty permalinks</a>.', 'tribe-events-calendar'), $tec->getLink('home'), $tec->getLink('home '), trailingslashit(get_admin_url())) . '</p>', 'conditional' => '' == get_option('permalink_structure')), 'eventsSlug' => array('type' => 'text', 'label' => __('Events URL slug', 'tribe-events-calendar'), 'default' => 'events', 'validation_type' => 'slug', 'conditional' => '' != get_option('permalink_structure')), 'current-events-slug' => array('type' => 'html', 'html' => '<p class="tribe-field-indent tribe-field-description description">' . __('The slug used for building the events URL.', 'tribe-events-calendar') . sprintf(__('Your current events URL is: %s', 'tribe-events-calendar'), '<code><a href="' . tribe_get_events_link() . '">' . tribe_get_events_link() . '</a></code>') . '</p>', 'conditional' => '' != get_option('permalink_structure')), 'ical-info' => array('type' => 'html', 'display_callback' => function_exists('tribe_get_ical_link') ? '<p id="ical-link" class="tribe-field-indent tribe-field-description description">' . __('Here is the iCal feed URL for your events:', 'tribe-events-calendar') . ' ' . '<code>' . tribe_get_ical_link() . '</code></p>' : '', 'conditional' => function_exists('tribe_get_ical_link')), 'singleEventSlug' => array('type' => 'text', 'label' => __('Single event URL slug', 'tribe-events-calendar'), 'default' => 'event', 'validation_type' => 'slug', 'conditional' => '' != get_option('permalink_structure')), 'current-single-event-slug' => array('type' => 'html', 'html' => '<p class="tribe-field-indent tribe-field-description description">' . sprintf(__('The above should ideally be plural, and this singular.<br />Your single event URL is: %s', 'tribe-events-calendar'), '<code>' . trailingslashit(home_url()) . tribe_get_option('singleEventSlug', 'event') . '/single-post-name/' . '</code>') . '</p>', 'conditional' => '' != get_option('permalink_structure')), 'multiDayCutoff' => array('type' => 'dropdown', 'label' => __('End of day cutoff', 'tribe-events-calendar'), 'validation_type' => 'options', 'size' => 'small', 'default' => '12:00', 'options' => array('12:00' => '12:00 am', '12:30' => '12:30 am', '01:00' => '01:00 am', '01:30' => '01:30 am', '02:00' => '02:00 am', '02:30' => '02:30 am', '03:00' => '03:00 am', '03:30' => '03:30 am', '04:00' => '04:00 am', '04:30' => '04:30 am', '05:00' => '05:00 am', '05:30' => '05:30 am', '06:00' => '06:00 am', '06:30' => '06:30 am', '07:00' => '07:00 am', '07:30' => '07:30 am', '08:00' => '08:00 am', '08:30' => '08:30 am', '09:00' => '09:00 am', '09:30' => '09:30 am', '10:00' => '10:00 am', '10:30' => '10:30 am', '11:00' => '11:00 am', '11:30' => '11:30 am')), 'multiDayCutoffHelper' => array('type' => 'html', 'html' => '<p class="tribe-field-indent tribe-field-description description">' . sprintf(__('Have events that run past midnight? Control when your day official ends to avoid awkwardly adding your event to the next day.', 'tribe-events-calendar')) . '</p>', 'conditional' => '' != get_option('permalink_structure')), 'defaultCurrencySymbol' => array('type' => 'text', 'label' => __('Default currency symbol', 'tribe-events-calendar'), 'tooltip' => __('Set the default currency symbol for event costs. Note that this only impacts future events, and changes made will not apply retroactively.', 'tribe-events-calendar'), 'validation_type' => 'textarea', 'size' => 'small', 'default' => '$'), 'tribeEventsDisplayTitle' => array('type' => 'html', 'html' => '<h3>' . __('Map Settings', 'tribe-events-calendar') . '</h3>'), 'embedGoogleMaps' => array('type' => 'checkbox_bool', 'label' => __('Enable Google Maps', 'tribe-events-calendar'), 'tooltip' => __('Check to enable maps for events and venues.', 'tribe-events-calendar'), 'default' => true, 'class' => 'google-embed-size', 'validation_type' => 'boolean'), 'embedGoogleMapsZoom' => array('type' => 'text', 'label' => __('Google Maps default zoom level', 'tribe-events-calendar'), 'tooltip' => __('0 = zoomed out; 21 = zoomed in.', 'tribe-events-calendar'), 'size' => 'small', 'default' => 10, 'class' => 'google-embed-field', 'validation_type' => 'number_or_percent'), 'tribeEventsMiscellaneousTitle' => array('type' => 'html', 'html' => '<h3>' . __('Miscellaneous Settings', 'tribe-events-calendar') . '</h3>'), 'amalgamateDuplicates' => array('type' => 'html', 'html' => '<fieldset class="tribe-field tribe-field-html"><legend>' . __('Duplicate Venues & Organizers', 'tribe-events-calendar') . '</legend><div class="tribe-field-wrap">' . Tribe_Amalgamator::migration_button(__('Merge Duplicates', 'tribe-events-calendar')) . '<p class="tribe-field-indent description">' . __('You might find duplicate venues and organizers when updating The Events Calendar from a pre-3.0 version. Click this button to automatically merge identical venues and organizers.', 'tribe-events-calendar') . '</p></div></fieldset><div class="clear"></div>', 'conditional' => $tec->getOption('organizer_venue_amalgamation', 0) < 1), 'debugEvents' => array('type' => 'checkbox_bool', 'label' => __('Debug mode', 'tribe-events-calendar'), 'default' => false, 'validation_type' => 'boolean'), 'debugEventsHelper' => array('type' => 'html', 'html' => '<p class="tribe-field-indent tribe-field-description description" style="max-width:400px;">' . sprintf(__('Enable this option to log debug information. By default this will log to your server PHP error log. If you\'d like to see the log messages in your browser, then we recommend that you install the %s and look for the "Tribe" tab in the debug output.', 'tribe-events-calendar'), '<a href="http://wordpress.org/extend/plugins/debug-bar/" target="_blank">' . __('Debug Bar Plugin', 'tribe-events-calendar') . '</a>') . '</p>', 'conditional' => '' != get_option('permalink_structure')), 'tribe-form-content-end' => array('type' => 'html', 'html' => '</div>'))));
function mfn_breadcrumbs($class = false) { global $post; $translate['home'] = mfn_opts_get('translate') ? mfn_opts_get('translate-home', 'Home') : __('Home', 'betheme'); $homeLink = home_url(); $separator = ' <span><i class="icon-right-open"></i></span>'; // Plugin | bbPress ----------------------------------- if (function_exists('is_bbpress') && is_bbpress()) { bbp_breadcrumb(array('before' => '<ul class="breadcrumbs">', 'after' => '</ul>', 'sep' => '<i class="icon-right-open"></i>', 'crumb_before' => '<li>', 'crumb_after' => '</li>', 'home_text' => $translate['home'])); return true; } // end: bbPress ------------------------------------- // Default breadcrumbs -------------------------------- $breadcrumbs = array(); // Home prefix -------------------------------- $breadcrumbs[] = '<a href="' . $homeLink . '">' . $translate['home'] . '</a>'; // Blog ------------------------------------------- if (get_post_type() == 'post') { $blogID = false; if (get_option('page_for_posts')) { $blogID = get_option('page_for_posts'); // Setings / Reading } elseif (mfn_opts_get('blog-page')) { $blogID = mfn_opts_get('blog-page'); // Theme Options / Getting Started / Blog } if ($blogID) { $breadcrumbs[] = '<a href="' . get_permalink($blogID) . '">' . get_the_title($blogID) . '</a>'; } } // Plugin | Events Calendar ------------------------------------------- if (function_exists('tribe_is_month') && (tribe_is_event_query() || tribe_is_month() || tribe_is_event() || tribe_is_day() || tribe_is_venue())) { if (function_exists('tribe_get_events_link')) { $breadcrumbs[] = '<a href="' . tribe_get_events_link() . '">' . tribe_get_events_title() . '</a>'; } } elseif (is_front_page() || is_home()) { // do nothing // Blog | Tag ------------------------------------- } elseif (is_tag()) { $breadcrumbs[] = '<a href="' . curPageURL() . '">' . single_tag_title('', false) . '</a>'; // Blog | Category -------------------------------- } elseif (is_category()) { $breadcrumbs[] = '<a href="' . curPageURL() . '">' . single_cat_title('', false) . '</a>'; // Blog | Author ---------------------------------- } elseif (is_author()) { $breadcrumbs[] = '<a href="' . curPageURL() . '">' . get_the_author() . '</a>'; // Blog | Day ------------------------------------- } elseif (is_day()) { $breadcrumbs[] = '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a>'; $breadcrumbs[] = '<a href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '">' . get_the_time('F') . '</a>'; $breadcrumbs[] = '<a href="' . curPageURL() . '">' . get_the_time('d') . '</a>'; // Blog | Month ----------------------------------- } elseif (is_month()) { $breadcrumbs[] = '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a>'; $breadcrumbs[] = '<a href="' . curPageURL() . '">' . get_the_time('F') . '</a>'; // Blog | Year ------------------------------------ } elseif (is_year()) { $breadcrumbs[] = '<a href="' . curPageURL() . '">' . get_the_time('Y') . '</a>'; // Single ----------------------------------------- } elseif (is_single() && !is_attachment()) { // Custom Post Type ----------------- if (get_post_type() != 'post') { $post_type = get_post_type_object(get_post_type()); $slug = $post_type->rewrite; $portfolio_page_id = mfn_wpml_ID(mfn_opts_get('portfolio-page')); // Portfolio Page ------------ if ($slug['slug'] == mfn_opts_get('portfolio-slug', 'portfolio-item') && $portfolio_page_id) { $breadcrumbs[] = '<a href="' . get_page_link($portfolio_page_id) . '">' . get_the_title($portfolio_page_id) . '</a>'; } // Category ---------- if ($portfolio_page_id) { $terms = get_the_terms(get_the_ID(), 'portfolio-types'); if (!empty($terms) && !is_wp_error($terms)) { $term = $terms[0]; $breadcrumbs[] = '<a href="' . get_term_link($term) . '">' . $term->name . '</a>'; } } // Single Item -------- $breadcrumbs[] = '<a href="' . curPageURL() . '">' . get_the_title() . '</a>'; // Blog | Single -------------------- } else { $cat = get_the_category(); if (!empty($cat)) { $breadcrumbs[] = get_category_parents($cat[0], true, $separator); } $breadcrumbs[] = '<a href="' . curPageURL() . '">' . get_the_title() . '</a>'; } // Taxonomy --------------------------------------- } elseif (!is_page() && get_post_taxonomies()) { // Portfolio ------------------------ $post_type = get_post_type_object(get_post_type()); if ($post_type->name == 'portfolio' && ($portfolio_page_id = mfn_wpml_ID(mfn_opts_get('portfolio-page')))) { $breadcrumbs[] = '<a href="' . get_page_link($portfolio_page_id) . '">' . get_the_title($portfolio_page_id) . '</a>'; } $breadcrumbs[] = '<a href="' . curPageURL() . '">' . single_cat_title('', false) . '</a>'; // Page with parent ------------------------------- } elseif (is_page() && $post->post_parent) { $parent_id = $post->post_parent; $parents = array(); while ($parent_id) { $page = get_page($parent_id); $parents[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>'; $parent_id = $page->post_parent; } $parents = array_reverse($parents); $breadcrumbs = array_merge_recursive($breadcrumbs, $parents); $breadcrumbs[] = '<a href="' . curPageURL() . '">' . get_the_title(mfn_ID()) . '</a>'; // Default ---------------------------------------- } else { $breadcrumbs[] = '<a href="' . curPageURL() . '">' . get_the_title(mfn_ID()) . '</a>'; } // PRINT ------------------------------------------------------------------ echo '<ul class="breadcrumbs ' . $class . '">'; $count = count($breadcrumbs); $i = 1; foreach ($breadcrumbs as $bk => $bc) { if (strpos($bc, $separator)) { // Category parents fix echo '<li>' . $bc . '</li>'; } else { if ($i == $count) { $separator = ''; } echo '<li>' . $bc . $separator . '</li>'; } $i++; } echo '</ul>'; }
/** * filter the link for tags when showing in an event */ public function tag_link($termlink, $term, $taxonomy) { global $post; if (is_object($post) && $post->post_type == self::POSTTYPE && $taxonomy == 'post_tag') { $termlink = esc_url(trailingslashit(tribe_get_events_link() . 'tag/' . $term->name)); } return $termlink; }
<?php $tec = Tribe__Events__Main::instance(); $generalTabFields = array('info-start' => array('type' => 'html', 'html' => '<div id="modern-tribe-info"><img src="' . plugins_url('resources/images/modern-tribe@2x.png', dirname(__FILE__)) . '" alt="Modern Tribe Inc." title="Modern Tribe Inc.">'), 'upsell-heading' => array('type' => 'heading', 'label' => __('Finding & extending your calendar.', 'the-events-calendar'), 'conditional' => !defined('TRIBE_HIDE_UPSELL') || !TRIBE_HIDE_UPSELL), 'finding-heading' => array('type' => 'heading', 'label' => __('Finding your calendar.', 'the-events-calendar'), 'conditional' => defined('TRIBE_HIDE_UPSELL') && TRIBE_HIDE_UPSELL), 'view-calendar-link' => array('type' => 'html', 'html' => '<p>' . __('Where\'s my calendar?', 'the-events-calendar') . ' <a href="' . esc_url(Tribe__Events__Main::getLink()) . '">' . __('Right here', 'the-events-calendar') . '</a>.</p>'), 'upsell-info' => array('type' => 'html', 'html' => '<p>' . __('Looking for additional functionality including recurring events, custom meta, community events, ticket sales and more?', 'the-events-calendar') . ' <a href="' . self::$tecUrl . 'products/?utm_source=generaltab&utm_medium=plugin-tec&utm_campaign=in-app">' . __('Check out the available add-ons', 'the-events-calendar') . '</a>.</p>', 'conditional' => !defined('TRIBE_HIDE_UPSELL') || !TRIBE_HIDE_UPSELL), 'donate-link-heading' => array('type' => 'heading', 'label' => __('We hope our plugin is helping you out.', 'the-events-calendar')), 'donate-link-info' => array('type' => 'html', 'html' => '<p>' . __('Are you thinking "Wow, this plugin is amazing! I should say thanks to Modern Tribe for all their hard work." The greatest thanks we could ask for is recognition. Add a small text-only link at the bottom of your calendar pointing to The Events Calendar project.', 'the-events-calendar') . '<br><a href="' . esc_url(plugins_url('resources/images/donate-link-screenshot.jpg', dirname(__FILE__))) . '" class="thickbox">' . __('See an example of the link', 'the-events-calendar') . '</a>.</p>', 'conditional' => !class_exists('Tribe__Events__Pro__Main')), 'donate-link-pro-info' => array('type' => 'html', 'html' => '<p>' . __('Are you thinking "Wow, this plugin is amazing! I should say thanks to Modern Tribe for all their hard work." The greatest thanks we could ask for is recognition. Add a small text only link at the bottom of your calendar pointing to The Events Calendar project.', 'the-events-calendar') . '<br><a href="' . esc_url(plugins_url('resources/images/donate-link-pro-screenshot.jpg', dirname(__FILE__))) . '" class="thickbox">' . __('See an example of the link', 'the-events-calendar') . '</a>.</p>', 'conditional' => class_exists('Tribe__Events__Pro__Main')), 'donate-link' => array('type' => 'checkbox_bool', 'label' => __('Show The Events Calendar link', 'the-events-calendar'), 'default' => false, 'validation_type' => 'boolean'), 'info-end' => array('type' => 'html', 'html' => '</div>'), 'tribe-form-content-start' => array('type' => 'html', 'html' => '<div class="tribe-settings-form-wrap">'), 'tribeEventsDisplayThemeTitle' => array('type' => 'html', 'html' => '<h2>' . __('General Settings', 'the-events-calendar') . '</h2>'), 'postsPerPage' => array('type' => 'text', 'label' => __('Number of events to show per page', 'the-events-calendar'), 'size' => 'small', 'default' => get_option('posts_per_page'), 'validation_type' => 'positive_int'), 'liveFiltersUpdate' => array('type' => 'checkbox_bool', 'label' => __('Use Javascript to control date filtering', 'the-events-calendar'), 'tooltip' => tribe_get_option('tribeDisableTribeBar', false) == true ? __('This option is disabled when "Disable the Event Search Bar" is checked on the Display settings tab.', 'the-events-calendar') : __('Enable live ajax for datepicker on front end (User submit not required).', 'the-events-calendar'), 'attributes' => tribe_get_option('tribeDisableTribeBar', false) == true ? array('disabled' => 'disabled') : null, 'default' => true, 'validation_type' => 'boolean', 'class' => tribe_get_option('tribeDisableTribeBar', false) == true ? 'tribe-fieldset-disabled' : null), 'showComments' => array('type' => 'checkbox_bool', 'label' => __('Show comments', 'the-events-calendar'), 'tooltip' => __('Enable comments on event pages.', 'the-events-calendar'), 'default' => false, 'validation_type' => 'boolean'), 'showEventsInMainLoop' => array('type' => 'checkbox_bool', 'label' => __('Include events in main blog loop', 'the-events-calendar'), 'tooltip' => __('Show events with the site\'s other posts. When this box is checked, events will also continue to appear on the default events page.', 'the-events-calendar'), 'default' => false, 'validation_type' => 'boolean'), 'unprettyPermalinksUrl' => array('type' => 'html', 'label' => __('Events URL slug', 'the-events-calendar'), 'html' => '<p>' . sprintf(__('You cannot edit the slug for your events page as you do not have pretty permalinks enabled. The current URL for your events page is <a href="%1$s">%2$s</a>. In order to edit the slug here, <a href="%3$soptions-permalink.php">enable pretty permalinks</a>.', 'the-events-calendar'), esc_url($tec->getLink('home')), $tec->getLink('home '), esc_url(trailingslashit(get_admin_url()))) . '</p>', 'conditional' => '' == get_option('permalink_structure')), 'eventsSlug' => array('type' => 'text', 'label' => __('Events URL slug', 'the-events-calendar'), 'default' => 'events', 'validation_type' => 'slug', 'conditional' => '' != get_option('permalink_structure')), 'current-events-slug' => array('type' => 'html', 'html' => '<p class="tribe-field-indent tribe-field-description description">' . __('The slug used for building the events URL.', 'the-events-calendar') . sprintf(__('Your current events URL is: %s', 'the-events-calendar'), '<code><a href="' . esc_url(tribe_get_events_link()) . '">' . tribe_get_events_link() . '</a></code>') . '</p>', 'conditional' => '' != get_option('permalink_structure')), 'ical-info' => array('type' => 'html', 'display_callback' => function_exists('tribe_get_ical_link') ? '<p id="ical-link" class="tribe-field-indent tribe-field-description description">' . __('Here is the iCal feed URL for your events:', 'the-events-calendar') . ' <code>' . tribe_get_ical_link() . '</code></p>' : '', 'conditional' => function_exists('tribe_get_ical_link')), 'singleEventSlug' => array('type' => 'text', 'label' => __('Single event URL slug', 'the-events-calendar'), 'default' => 'event', 'validation_type' => 'slug', 'conditional' => '' != get_option('permalink_structure')), 'current-single-event-slug' => array('type' => 'html', 'html' => '<p class="tribe-field-indent tribe-field-description description">' . sprintf(__('The above should ideally be plural, and this singular.<br />Your single event URL is: %s', 'the-events-calendar'), '<code>' . trailingslashit(home_url()) . tribe_get_option('singleEventSlug', 'event') . '/single-post-name/</code>') . '</p>', 'conditional' => '' != get_option('permalink_structure')), 'multiDayCutoff' => array('type' => 'dropdown', 'label' => __('End of day cutoff', 'the-events-calendar'), 'validation_type' => 'options', 'size' => 'small', 'default' => '12:00', 'options' => array('00:00' => '12:00 am', '01:00' => '01:00 am', '02:00' => '02:00 am', '03:00' => '03:00 am', '04:00' => '04:00 am', '05:00' => '05:00 am', '06:00' => '06:00 am', '07:00' => '07:00 am', '08:00' => '08:00 am', '09:00' => '09:00 am', '10:00' => '10:00 am', '11:00' => '11:00 am')), 'multiDayCutoffHelper' => array('type' => 'html', 'html' => '<p class="tribe-field-indent tribe-field-description description">' . sprintf(__("Have an event that runs past midnight? Select a time after that event's end to avoid showing the event on the next day's calendar.", 'the-events-calendar')) . '</p>', 'conditional' => '' != get_option('permalink_structure')), 'defaultCurrencySymbol' => array('type' => 'text', 'label' => __('Default currency symbol', 'the-events-calendar'), 'tooltip' => __('Set the default currency symbol for event costs. Note that this only impacts future events, and changes made will not apply retroactively.', 'the-events-calendar'), 'validation_type' => 'textarea', 'size' => 'small', 'default' => '$'), 'reverseCurrencyPosition' => array('type' => 'checkbox_bool', 'label' => __('Currency symbol follows value', 'the-events-calendar'), 'tooltip' => __('The currency symbol normally precedes the value. Enabling this option positions the symbol after the value.', 'the-events-calendar'), 'default' => false, 'validation_type' => 'boolean'), 'tribeEventsDisplayTitle' => array('type' => 'html', 'html' => '<h2>' . __('Map Settings', 'the-events-calendar') . '</h2>'), 'embedGoogleMaps' => array('type' => 'checkbox_bool', 'label' => __('Enable Google Maps', 'the-events-calendar'), 'tooltip' => __('Check to enable maps for events and venues.', 'the-events-calendar'), 'default' => true, 'class' => 'google-embed-size', 'validation_type' => 'boolean'), 'embedGoogleMapsZoom' => array('type' => 'text', 'label' => __('Google Maps default zoom level', 'the-events-calendar'), 'tooltip' => __('0 = zoomed out; 21 = zoomed in.', 'the-events-calendar'), 'size' => 'small', 'default' => 10, 'class' => 'google-embed-field', 'validation_type' => 'number_or_percent'), 'tribeEventsMiscellaneousTitle' => array('type' => 'html', 'html' => '<h2>' . __('Miscellaneous Settings', 'the-events-calendar') . '</h2>'), 'amalgamateDuplicates' => array('type' => 'html', 'html' => '<fieldset class="tribe-field tribe-field-html"><legend>' . __('Duplicate Venues & Organizers', 'the-events-calendar') . '</legend><div class="tribe-field-wrap">' . Tribe__Events__Amalgamator::migration_button(__('Merge Duplicates', 'the-events-calendar')) . '<p class="tribe-field-indent description">' . __('You might find duplicate venues and organizers when updating The Events Calendar from a pre-3.0 version. Click this button to automatically merge identical venues and organizers.', 'the-events-calendar') . '</p></div></fieldset><div class="clear"></div>', 'conditional' => $tec->getOption('organizer_venue_amalgamation', 0) < 1), 'viewWelcomePage' => array('type' => 'html', 'html' => '<fieldset class="tribe-field tribe-field-html"><legend>' . __('View Welcome Page', 'the-events-calendar') . '</legend><div class="tribe-field-wrap"><a href="' . esc_url(get_site_url() . '/wp-admin/edit.php?post_type=tribe_events&page=tribe-events-calendar&tec-welcome-message') . '" class="button">' . __('View Welcome Page', 'the-events-calendar') . '</a><p class="tribe-field-indent description">' . __('View the page that displayed when you initially installed the plugin.', 'the-events-calendar') . '</p></div></fieldset><div class="clear"></div>'), 'viewUpdatePage' => array('type' => 'html', 'html' => '<fieldset class="tribe-field tribe-field-html"><legend>' . __('View Update Page', 'the-events-calendar') . '</legend><div class="tribe-field-wrap"><a href="' . esc_url(get_site_url() . '/wp-admin/edit.php?post_type=tribe_events&page=tribe-events-calendar&tec-update-message') . '" class="button">' . __('View Update Page', 'the-events-calendar') . '</a><p class="tribe-field-indent description">' . __('View the page that displayed when you updated the plugin.', 'the-events-calendar') . '</p></div></fieldset><div class="clear"></div>')); if (is_super_admin()) { $generalTabFields['debugEvents'] = array('type' => 'checkbox_bool', 'label' => __('Debug mode', 'the-events-calendar'), 'default' => false, 'validation_type' => 'boolean'); $generalTabFields['debugEventsHelper'] = array('type' => 'html', 'html' => '<p class="tribe-field-indent tribe-field-description description" style="max-width:400px;">' . sprintf(__('Enable this option to log debug information. By default this will log to your server PHP error log. If you\'d like to see the log messages in your browser, then we recommend that you install the %s and look for the "Tribe" tab in the debug output.', 'the-events-calendar'), '<a href="http://wordpress.org/extend/plugins/debug-bar/" target="_blank">' . __('Debug Bar Plugin', 'the-events-calendar') . '</a>') . '</p>', 'conditional' => '' != get_option('permalink_structure')); } // Closes form $generalTabFields['tribe-form-content-end'] = array('type' => 'html', 'html' => '</div>'); $generalTab = array('priority' => 10, 'fields' => apply_filters('tribe_general_settings_tab_fields', $generalTabFields));
/** * Fetch and return required events. * @param array $atts shortcode attributes * @return string shortcode output */ public function ecs_fetch_events($atts) { /** * Check if events calendar plugin method exists */ if (!function_exists('tribe_get_events')) { return; } global $wp_query, $post; $output = ''; $atts = shortcode_atts(array('cat' => '', 'month' => '', 'limit' => 5, 'eventdetails' => 'true', 'time' => null, 'past' => null, 'venue' => 'false', 'author' => null, 'message' => sprintf(__('There are no upcoming %s at this time.', 'tribe-events-calendar'), tribe_get_event_label_plural()), 'key' => 'End Date', 'order' => 'ASC', 'viewall' => 'false', 'excerpt' => 'false', 'thumb' => 'false', 'thumbwidth' => '', 'thumbheight' => '', 'contentorder' => 'title, thumbnail, excerpt, date, venue', 'event_tax' => ''), $atts, 'ecs-list-events'); // Category if ($atts['cat']) { if (strpos($atts['cat'], ",") !== false) { $atts['cats'] = explode(",", $atts['cat']); $atts['cats'] = array_map('trim', $atts['cats']); } else { $atts['cats'] = $atts['cat']; } $atts['event_tax'] = array('relation' => 'OR', array('taxonomy' => 'tribe_events_cat', 'field' => 'name', 'terms' => $atts['cats']), array('taxonomy' => 'tribe_events_cat', 'field' => 'slug', 'terms' => $atts['cats'])); } // Past Event $meta_date_compare = '>='; $meta_date_date = date('Y-m-d'); if ($atts['time'] == 'past' || !empty($atts['past'])) { $meta_date_compare = '<'; } // Key if (str_replace(' ', '', trim(strtolower($atts['key']))) == 'startdate') { $atts['key'] = '_EventStartDate'; } else { $atts['key'] = '_EventEndDate'; } // Date $atts['meta_date'] = array(array('key' => $atts['key'], 'value' => $meta_date_date, 'compare' => $meta_date_compare, 'type' => 'DATETIME')); // Specific Month if ($atts['month'] == 'current') { $atts['month'] = date('Y-m'); } if ($atts['month']) { $month_array = explode("-", $atts['month']); $month_yearstr = $month_array[0]; $month_monthstr = $month_array[1]; $month_startdate = date($month_yearstr . "-" . $month_monthstr . "-1"); $month_enddate = date($month_yearstr . "-" . $month_monthstr . "-t"); $atts['meta_date'] = array(array('key' => $atts['key'], 'value' => array($month_startdate, $month_enddate), 'compare' => 'BETWEEN', 'type' => 'DATETIME')); } $posts = get_posts(array('post_type' => 'tribe_events', 'posts_per_page' => $atts['limit'], 'tax_query' => $atts['event_tax'], 'meta_key' => $atts['key'], 'orderby' => 'meta_value', 'author' => $atts['author'], 'order' => $atts['order'], 'meta_query' => array($atts['meta_date']))); if ($posts) { $output .= '<ul class="ecs-event-list">'; $atts['contentorder'] = explode(',', $atts['contentorder']); foreach ($posts as $post) { setup_postdata($post); $li_classes = 'ecs-event'; $start_date = tribe_get_start_date($post, false, 'Y-m-d'); $today = date('Y-m-d', current_time('timestamp')); $tomorrow = date('Y-m-d', strtotime('tomorrow', current_time('timestamp'))); if ($start_date == $today) { $li_classes .= ' ecs-today'; } else { if ($start_date == $tomorrow) { $li_classes .= ' ecs-tomorrow'; } } $output .= '<li class="' . $li_classes . '">'; // Put Values into $output foreach ($atts['contentorder'] as $contentorder) { switch (trim($contentorder)) { case 'title': $output .= '<h4 class="entry-title summary">' . '<a href="' . tribe_get_event_link() . '" rel="bookmark">' . apply_filters('ecs_event_list_title', get_the_title(), $atts) . '</a> </h4>'; break; case 'thumbnail': if (self::isValid($atts['thumb'])) { $thumbWidth = is_numeric($atts['thumbwidth']) ? $atts['thumbwidth'] : ''; $thumbHeight = is_numeric($atts['thumbheight']) ? $atts['thumbheight'] : ''; if (!empty($thumbWidth) && !empty($thumbHeight)) { $output .= get_the_post_thumbnail($post->ID, array($thumbWidth, $thumbHeight)); } else { $size = !empty($thumbWidth) && !empty($thumbHeight) ? array($thumbWidth, $thumbHeight) : 'medium'; if ($thumb = get_the_post_thumbnail($post->ID, $size)) { $output .= '<a href="' . tribe_get_event_link() . '">'; $output .= $thumb; $output .= '</a>'; } } } break; case 'excerpt': if (self::isValid($atts['excerpt'])) { $excerptLength = is_numeric($atts['excerpt']) ? $atts['excerpt'] : 100; $output .= '<p class="ecs-excerpt">' . self::get_excerpt($excerptLength) . '</p>'; } break; case 'date': if (self::isValid($atts['eventdetails'])) { $output .= '<span class="duration time">' . apply_filters('ecs_event_list_details', tribe_events_event_schedule_details(), $atts) . '</span>'; } break; case 'venue': if (self::isValid($atts['venue'])) { $output .= '<span class="duration venue">' . apply_filters('ecs_event_list_venue', ' <em>at</em> ' . tribe_get_venue(), $atts) . '</span>'; } break; } } $output .= '</li>'; } $output .= '</ul>'; if (self::isValid($atts['viewall'])) { $output .= '<span class="ecs-all-events"><a href="' . apply_filters('ecs_event_list_viewall_link', tribe_get_events_link(), $atts) . '" rel="bookmark">' . translate(apply_filters('ecs_event_list_viewall_text', 'View All Events', $atts), 'tribe-events-calendar') . '</a></span>'; } } else { //No Events were Found $output .= translate($atts['message'], 'tribe-events-calendar'); } // endif wp_reset_query(); return $output; }
/** * If a themer usees get_post_type_archive_link() to find the event archive URL, this * ensures they get the correct result. * * @param string $link * @param string $post_type * @return string */ public function event_archive_link($link, $post_type) { return self::POSTTYPE === $post_type ? tribe_get_events_link() : $link; }
/** * Returns the URL for the list widget's "View All" link. * * @param array $instance * * @return string **/ function tribe_events_get_list_widget_view_all_link($instance) { $link_to_all = ''; if (empty($instance['filters'])) { $link_to_archive = false; $link_to_all = tribe_get_events_link(); return apply_filters('tribe_events_get_list_widget_view_all_link', $link_to_all); } // Have taxonomy filters been applied? $filters = json_decode($instance['filters'], true); // Is the filter restricted to a single taxonomy? $single_taxonomy = is_array($filters) && 1 === count($filters); $single_term = false; // Pull the actual taxonomy and list of terms into scope if ($single_taxonomy) { foreach ($filters as $taxonomy => $terms) { } } // If we have a single taxonomy and a single term, the View All link should point to the relevant archive page if ($single_taxonomy && 1 === count($terms)) { $link_to_archive = true; $link_to_all = get_term_link(absint($terms[0]), $taxonomy); } else { $link_to_archive = false; $link_to_all = tribe_get_events_link(); } return apply_filters('tribe_events_get_list_widget_view_all_link', $link_to_all); }
</div> <?php do_action('tribe_events_list_widget_after_the_meta'); ?> </div> </li> <?php } ?> </ol><!-- .hfeed --> <p class="tribe-events-widget-link"> <a href="<?php echo esc_url(tribe_get_events_link()); ?> " rel="bookmark"><?php printf(__('View All %s', 'the-events-calendar'), $events_label_plural); ?> </a> </p> <?php // No events were found. } else { ?> <p><?php printf(__('There are no upcoming %s at this time.', 'the-events-calendar'), strtolower($events_label_plural)); ?> </p>
/** * Fetch and return required events. * @param array $atts shortcode attributes * @return string shortcode output */ public function ecs_fetch_events($atts) { /** * Check if events calendar plugin method exists */ if (!function_exists('tribe_get_events')) { return; } global $wp_query, $post; $output = ''; $atts = shortcode_atts(apply_filters('ecs_shortcode_atts', array('cat' => '', 'month' => '', 'limit' => 5, 'eventdetails' => 'true', 'time' => null, 'past' => null, 'venue' => 'false', 'author' => null, 'message' => 'There are no upcoming events at this time.', 'key' => 'End Date', 'order' => 'ASC', 'viewall' => 'false', 'excerpt' => 'false', 'thumb' => 'false', 'thumbwidth' => '', 'thumbheight' => '', 'contentorder' => apply_filters('ecs_default_contentorder', 'title, thumbnail, excerpt, date, venue', $atts), 'event_tax' => ''), $atts), $atts, 'ecs-list-events'); // Category if ($atts['cat']) { if (strpos($atts['cat'], ",") !== false) { $atts['cats'] = explode(",", $atts['cat']); $atts['cats'] = array_map('trim', $atts['cats']); } else { $atts['cats'] = $atts['cat']; } $atts['event_tax'] = array('relation' => 'OR', array('taxonomy' => 'tribe_events_cat', 'field' => 'name', 'terms' => $atts['cats']), array('taxonomy' => 'tribe_events_cat', 'field' => 'slug', 'terms' => $atts['cats'])); } // Past Event $meta_date_compare = '>='; $meta_date_date = current_time('Y-m-d H:i:s'); if ($atts['time'] == 'past' || !empty($atts['past'])) { $meta_date_compare = '<'; } // Key if (str_replace(' ', '', trim(strtolower($atts['key']))) == 'startdate') { $atts['key'] = '_EventStartDate'; } else { $atts['key'] = '_EventEndDate'; } // Date $atts['meta_date'] = array(array('key' => $atts['key'], 'value' => $meta_date_date, 'compare' => $meta_date_compare, 'type' => 'DATETIME')); // Specific Month if ($atts['month'] == 'current') { $atts['month'] = date('Y-m'); } if ($atts['month']) { $month_array = explode("-", $atts['month']); $month_yearstr = $month_array[0]; $month_monthstr = $month_array[1]; $month_startdate = date("Y-m-d", strtotime($month_yearstr . "-" . $month_monthstr . "-01")); $month_enddate = date("Y-m-01", strtotime("+1 month", strtotime($month_startdate))); $atts['meta_date'] = array(array('key' => $atts['key'], 'value' => array($month_startdate, $month_enddate), 'compare' => 'BETWEEN', 'type' => 'DATETIME')); } $posts = tribe_get_events(apply_filters('ecs_get_events_args', array('post_status' => 'publish', 'hide_upcoming' => true, 'posts_per_page' => $atts['limit'], 'tax_query' => $atts['event_tax'], 'meta_key' => $atts['key'], 'orderby' => 'meta_value', 'author' => $atts['author'], 'order' => $atts['order'], 'meta_query' => array($atts['meta_date'])), $atts)); if ($posts) { $output .= apply_filters('ecs_start_tag', '<ul class="ecs-event-list">', $atts); $atts['contentorder'] = explode(',', $atts['contentorder']); foreach ($posts as $post) { setup_postdata($post); $output .= apply_filters('ecs_event_start_tag', '<li class="ecs-event">', $atts, $post); // Put Values into $output foreach (apply_filters('ecs_event_contentorder', $atts['contentorder'], $atts, $post) as $contentorder) { switch (trim($contentorder)) { case 'title': $output .= apply_filters('ecs_event_title_tag_start', '<h4 class="entry-title summary">', $atts, $post) . '<a href="' . tribe_get_event_link() . '" rel="bookmark">' . apply_filters('ecs_event_list_title', get_the_title(), $atts, $post) . '</a>' . apply_filters('ecs_event_title_tag_end', '</h4>', $atts, $post); break; case 'thumbnail': if (self::isValid($atts['thumb'])) { $thumbWidth = is_numeric($atts['thumbwidth']) ? $atts['thumbwidth'] : ''; $thumbHeight = is_numeric($atts['thumbheight']) ? $atts['thumbheight'] : ''; if (!empty($thumbWidth) && !empty($thumbHeight)) { $output .= apply_filters('ecs_event_thumbnail', get_the_post_thumbnail(get_the_ID(), apply_filters('ecs_event_thumbnail_size', array($thumbWidth, $thumbHeight), $atts, $post)), $atts, $post); } else { if ($thumb = get_the_post_thumbnail(get_the_ID(), apply_filters('ecs_event_thumbnail_size', 'medium', $atts, $post))) { $output .= apply_filters('ecs_event_thumbnail_link_start', '<a href="' . tribe_get_event_link() . '">', $atts, $post); $output .= apply_filters('ecs_event_thumbnail', $thumb, $atts, $post); $output .= apply_filters('ecs_event_thumbnail_link_end', '</a>', $atts, $post); } } } break; case 'excerpt': if (self::isValid($atts['excerpt'])) { $excerptLength = is_numeric($atts['excerpt']) ? $atts['excerpt'] : 100; $output .= apply_filters('ecs_event_excerpt_tag_start', '<p class="ecs-excerpt">', $atts, $post) . apply_filters('ecs_event_excerpt', self::get_excerpt($excerptLength), $atts, $post) . apply_filters('ecs_event_excerpt_tag_end', '</p>', $atts, $post); } break; case 'date': if (self::isValid($atts['eventdetails'])) { $output .= apply_filters('ecs_event_date_tag_start', '<span class="duration time">', $atts, $post) . apply_filters('ecs_event_list_details', tribe_events_event_schedule_details(), $atts, $post) . apply_filters('ecs_event_date_tag_end', '</span>', $atts, $post); } break; case 'venue': if (self::isValid($atts['venue'])) { $output .= apply_filters('ecs_event_venue_tag_start', '<span class="duration venue">', $atts, $post) . apply_filters('ecs_event_venue_at_tag_start', '<em> ', $atts, $post) . apply_filters('ecs_event_venue_at_text', __('at', 'the-events-calendar-shortcode'), $atts, $post) . apply_filters('ecs_event_venue_at_tag_end', ' </em>', $atts, $post) . apply_filters('ecs_event_list_venue', tribe_get_venue(), $atts, $post) . apply_filters('ecs_event_venue_tag_end', '</span>', $atts, $post); } break; case 'date_thumb': if (self::isValid($atts['eventdetails'])) { $output .= apply_filters('ecs_event_date_thumb', '<div class="date_thumb"><div class="month">' . tribe_get_start_date(null, false, 'M') . '</div><div class="day">' . tribe_get_start_date(null, false, 'j') . '</div></div>', $atts, $post); } break; default: $output .= apply_filters('ecs_event_list_output_custom', '', trim($contentorder), $atts, $post); } } $output .= apply_filters('ecs_event_end_tag', '</li>', $atts, $post); } $output .= apply_filters('ecs_end_tag', '</ul>', $atts); if (self::isValid($atts['viewall'])) { $output .= apply_filters('ecs_view_all_events_tag_start', '<span class="ecs-all-events">', $atts) . '<a href="' . apply_filters('ecs_event_list_viewall_link', tribe_get_events_link(), $atts) . '" rel="bookmark">' . translate('View All Events', 'tribe-events-calendar') . '</a>'; $output .= apply_filters('ecs_view_all_events_tag_end', '</span>'); } } else { //No Events were Found $output .= apply_filters('ecs_no_events_found_message', translate($atts['message'], 'tribe-events-calendar'), $atts); } // endif wp_reset_query(); return $output; }
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/single-event.php * * @package TribeEventsCalendar * */ if (!defined('ABSPATH')) { die('-1'); } $event_id = get_the_ID(); ?> <div id="tribe-events-content" class="tribe-events-single vevent hentry"> <p class="tribe-events-back"> <a href="<?php echo tribe_get_events_link(); ?> "> <?php _e('« All Events', 'tribe-events-calendar'); ?> </a> </p> <!-- Notices --> <?php tribe_events_the_notices(); ?> <!-- Event featured image, but exclude link --> <?php echo tribe_event_featured_image($event_id, 'full', false);
/** * Event Title * * Return an event's title with pseudo-breadcrumb if on a category * * @param bool $depth include linked title * @return string title * @since 2.0 */ function tribe_get_events_title($depth = true) { global $wp_query; $tribe_ecp = TribeEvents::instance(); $title = __('Upcoming Events', 'tribe-events-calendar'); // TODO: Use the displayed dates for the title /* if ( tribe_is_upcoming() || isset( $_REQUEST['tribe-bar-date'] ) ) { $start_date = date( 'Y-m-d', strtotime( $wp_query->get( 'start_date' ) ) ); if ( $wp_query->get( 'start_date' ) && $start_date != date('Y-m-d') ) { if ( get_query_var('paged') > 1 ) { // get the date of the first post $first_post = reset($wp_query->posts); $start_date = date('Y-m-d', strtotime($first_post->EventStartDate)); } $format = __('Events for %1$s', 'tribe-events-calendar'); $args = array(date_i18n( get_option( 'date_format', 'Y-m-d' ), strtotime($start_date) )); // Get the date of the last post if ( count($wp_query->posts) > 1 ) { $last_post = end($wp_query->posts); $last_post_date = date('Y-m-d', strtotime($last_post->EventStartDate)); if ( $last_post_date != $start_date ) { $format = __('Events for %1$s through %2$s', 'tribe-events-calendar'); $args[] = date_i18n( get_option( 'date_format', 'Y-m-d' ), strtotime($last_post_date) ); } } $title = vsprintf($format, $args); } } else */ if (tribe_is_past()) { $title = __('Past Events', 'tribe-events-calendar'); } if (tribe_is_month()) { $title = sprintf(__('Events for %s', 'tribe-events-calendar'), date_i18n(__('F Y', 'tribe-events-calendar'), strtotime(tribe_get_month_view_date()))); } if (is_tax($tribe_ecp->get_event_taxonomy())) { $cat = get_queried_object(); if ($depth) { $title = '<a href="' . tribe_get_events_link() . '">' . $title . '</a>'; $title .= ' › ' . $cat->name; } else { $title = $cat->name; } } return apply_filters('tribe_template_factory_debug', apply_filters('tribe_get_events_title', $title), 'tribe_get_events_title'); }