protected function is_event_404($status) { if (false === strpos($status, '404 Not Found')) { return false; } if (!tribe_is_event_query()) { return false; } return true; }
/** * Handler for the [tribe_events] shortcode. * * Please note that the shortcode should not be used alongside a regular event archive * view nor should it be used more than once in the same request - or else breakages may * occur. We try to limit accidental breakages by returning an empty string if we detect * any of the above scenarios. * * This limitation can be lifted once our CSS, JS and template classes are refactored to * support multiple instances of each view in the same request. * * @param $atts * * @return string */ public function tribe_events($atts) { static $deployed = false; if (tribe_is_event_query() || $deployed) { return ''; } $shortcode = new Tribe__Events__Pro__Shortcodes__Tribe_Events($atts); $deployed = true; return $shortcode->output(); }
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>'; }
*/ global $wpv_title; if (!is_404()) { if (wpv_has_woocommerce() && is_woocommerce() && !is_single()) { if (is_product_category()) { $wpv_title = single_cat_title('', false); } elseif (is_product_tag()) { $wpv_title = single_tag_title('', false); } else { $wpv_title = woocommerce_get_page_id('shop') ? get_the_title(woocommerce_get_page_id('shop')) : ''; } } } $page_header_bg = WpvTemplates::page_header_background(); $global_page_header_bg = wpv_get_option('page-title-background-image') . wpv_get_option('page-title-background-color'); if (!WpvTemplates::has_breadcrumbs() && !WpvTemplates::has_page_header() && !WpvTemplates::has_post_siblings_buttons() || is_404() && (!function_exists('tribe_is_event_query') || !tribe_is_event_query())) { return; } if (is_page_template('page-blank.php')) { return; } ?> <div id="sub-header" class="layout-<?php echo WpvTemplates::get_layout(); ?> <?php if (!empty($page_header_bg) || !empty($global_page_header_bg)) { echo 'has-background'; } ?> ">
function mfn_sidebar_classes() { $classes = false; if (mfn_ID()) { if (get_post_type() == 'page' && mfn_opts_get('single-page-layout')) { // Theme Options | Page $layout = mfn_opts_get('single-page-layout'); } elseif (get_post_type() == 'post' && is_single() && mfn_opts_get('single-layout')) { // Theme Options | Single Post $layout = mfn_opts_get('single-layout'); } else { // Post Meta $layout = get_post_meta(mfn_ID(), 'mfn-post-layout', true); } switch ($layout) { case 'left-sidebar': $classes = ' with_aside aside_left'; break; case 'right-sidebar': $classes = ' with_aside aside_right'; break; } // demo if ($_GET && key_exists('mfn-s', $_GET)) { if ($_GET['mfn-s']) { $classes = ' with_aside aside_right'; } else { $classes = false; } } } // bbPress if (function_exists('is_bbpress') && is_bbpress() && is_active_sidebar('forum')) { $classes = ' with_aside aside_right'; } // Events Calendar if (function_exists('tribe_is_month') && is_active_sidebar('events')) { if (tribe_is_month() || tribe_is_day() || tribe_is_event() || tribe_is_event_query() || tribe_is_venue()) { $classes = ' with_aside aside_right'; } } return $classes; }
/** * Determines if we are in list view. * * @return bool * @since 2.1 */ function tribe_is_list_view() { if (tribe_is_event_query() && (tribe_is_upcoming() || tribe_is_past() || tribe_is_day() || is_single() && tribe_is_showing_all())) { $return = true; } else { $return = false; } return apply_filters('tribe_is_list_view', $return); }
/** * Decide if we need to spoof the query. */ public static function maybeSpoofQuery() { // hijack this method right up front if it's a password protected post and the password isn't entered if (is_single() && post_password_required()) { return; } global $wp_query; if ($wp_query->is_main_query() && tribe_is_event_query() && tribe_get_option('tribeEventsTemplate', 'default') != '') { // we need to ensure that we always enter the loop, whether or not there are any events in the actual query $spoofed_post = self::spoofed_post(); $GLOBALS['post'] = $spoofed_post; $wp_query->posts[] = $spoofed_post; $wp_query->post_count = count($wp_query->posts); $wp_query->spoofed = true; $wp_query->rewind_posts(); } }
/** * Front-end styles */ public function styles() { if (is_admin() || WpvTemplates::is_login()) { return; } $theme_version = WpvFramework::get_version(); $external_fonts = maybe_unserialize(wpv_get_option('external-fonts')); if (is_array($external_fonts) && !empty($external_fonts)) { foreach ($external_fonts as $name => $url) { wp_enqueue_style('wpv-' . $name, $url, array(), $theme_version); } } wp_enqueue_style('front-magnific-popup', wpv_prepare_url(WPV_THEME_CSS . 'magnific.css')); $cache_timestamp = wpv_get_option('css-cache-timestamp'); $generated_deps = array('front-magnific-popup'); if (wpv_has_woocommerce()) { $generated_deps[] = 'woocommerce-layout'; $generated_deps[] = 'woocommerce-smallscreen'; $generated_deps[] = 'woocommerce-general'; } if (class_exists('Tribe__Events__Main') && (tribe_is_event_query() || tribe_is_event_organizer() || tribe_is_event_venue())) { $generated_deps[] = 'tribe-events-calendar-style'; $generated_deps[] = 'tribe-events-full-calendar-style'; } $suffix = is_multisite() ? $GLOBALS['blog_id'] : ''; $css_file = 'all' . $suffix . '.css'; $css_path = WPV_CACHE_URI . $css_file; if (!file_exists(WPV_CACHE_DIR . $css_file)) { $css_path = WPV_SAMPLES_URI . 'all-default.css'; } wp_enqueue_style('front-all', wpv_prepare_url($css_path), $generated_deps, $cache_timestamp); global $wpv_is_shortcode_preview; if ($wpv_is_shortcode_preview) { wp_enqueue_style('vamtam-shortcode-preview', WPV_ADMIN_ASSETS_URI . 'css/shortcode-preview.css'); } $custom_icons = get_option('vamtam-custom-icons-map'); if ($custom_icons) { $icons_path = trailingslashit(WP_CONTENT_URL) . 'vamtam/custom-icon-font/'; $custom_icons_css = "\n\t\t\t\t@font-face {\n\t\t\t\t\tfont-family: 'vamtam-custom-icons';\n\t\t\t\t\tsrc: url({$icons_path}custom-icons.eot);\n\t\t\t\t\tsrc: url({$icons_path}custom-icons.eot?#iefix) format('embedded-opentype'),\n\t\t\t\t\t\turl({$icons_path}custom-icons.ttf) format('truetype');\n\t\t\t\t\tfont-weight: normal;\n\t\t\t\t\tfont-style: normal;\n\t\t\t\t}\n\t\t\t"; wp_add_inline_style('front-all', $custom_icons_css); } }
/** * Are there any events next (in the future) to the current events in $wp_query * * @param string $return what to return, 'bool' or 'event' * * @return mixed */ function tribe_has_next_event($return = 'bool') { global $wp_query; $next_event = false; if (tribe_is_event_query() && !empty($wp_query->posts)) { // Edit the current event query to look for an upcoming event $args = (array) $wp_query->query; if (tribe_is_past()) { if ($wp_query->get('paged') > 1) { $args['eventDisplay'] = 'past'; $args['paged'] = $wp_query->get('paged') - 1; } else { // if we're on page one of the past, next events will be on page 1 of regular list view $args['eventDisplay'] = 'list'; $args['paged'] = 1; } } else { $args['eventDisplay'] = 'list'; $args['paged'] = $wp_query->get('paged') ? $wp_query->get('paged') + 1 : 2; } $events = tribe_get_events($args); $next_event = count($events) > 0; } // @todo 'tribe_has_past_events' filter is @deprecated as of 3.7 return apply_filters('tribe_has_next_event', apply_filters('tribe_has_next_events', $next_event)); }
get_template_part('slider/default', 'slider'); } } if (is_front_page()) { atp_generator('teaser_option'); } wp_reset_query(); } /** * Custom Search for Albums, Tracks and Artists * since - Musicplay 2.4.1 */ if (!is_front_page()) { get_template_part('custom', 'search'); } if (!is_front_page()) { if (function_exists('tribe_is_event_query')) { if (!tribe_is_event_query() || tribe_is_event_query() && is_singular() and !is_singular("albums") and !is_404() and !is_singular("artists") and !is_singular("gallery") and !is_singular("video")) { echo atp_generator('subheader', $frontpageid); } } else { if (!is_404()) { echo atp_generator('subheader', $frontpageid); } } } ?> <div id="main" class="<?php echo atp_generator('sidebaroption', $frontpageid); ?> ">
function tc_is_tec_events_list() { return function_exists('tribe_is_event_query') && tribe_is_event_query() && is_post_type_archive(); }
function tc_events_calendar_comp() { if (!tribe_is_event_query()) { return; } if (method_exists('TC_headings', 'tc_content_heading_title')) { remove_filter('the_title', array(TC_Headings::$instance, 'tc_content_heading_title'), 0); } if (method_exists('TC_headings', 'tc_add_edit_link_after_title')) { remove_filter('the_title', array(TC_Headings::$instance, 'tc_add_edit_link_after_title'), 2); } if (method_exists('TC_headings', 'tc_add_comment_bubble_after_title')) { remove_filter('the_title', array(TC_Headings::$instance, 'tc_add_comment_bubble_after_title'), 1); } }
/** * Enqueue the proper PRO scripts as necessary. * * @return void */ public function enqueue_pro_scripts() { if (tribe_is_event_query()) { // @TODO filter the tribe_events_resource_url() function $resources_url = trailingslashit($this->pluginUrl) . 'resources/'; $path = Tribe_Template_Factory::getMinFile($resources_url . 'tribe-events-pro.js', true); wp_enqueue_script('tribe-events-pro', $path, array('jquery', 'tribe-events-calendar-script'), apply_filters('tribe_events_pro_js_version', TribeEventsPro::VERSION), false); $geoloc = TribeEventsGeoLoc::instance(); $data = array('geocenter' => $geoloc->estimate_center_point(), 'map_tooltip_event' => __('Event: ', 'tribe-events-calendar-pro'), 'map_tooltip_address' => __('Address: ', 'tribe-events-calendar-pro')); $data = apply_filters('tribe_events_pro_localize_script', $data, 'TribeEventsPro', 'tribe-events-pro'); wp_localize_script('tribe-events-pro', 'TribeEventsPro', $data); } }
function axiom_is_tribe_events_page() { return class_exists('TribeEvents') ? tribe_is_event() || tribe_is_event_query() || tribe_is_event_category() || tribe_is_event_venue() || tribe_is_event_organizer() : false; }
function mfn_sidebar_classes($has_both = false) { $classes = false; $both = false; if (mfn_ID()) { if (get_post_type() == 'page' && mfn_opts_get('single-page-layout')) { // Theme Options | Single - Page $layout = mfn_opts_get('single-page-layout'); } elseif (get_post_type() == 'post' && is_single() && mfn_opts_get('single-layout')) { // Theme Options | Single - Post $layout = mfn_opts_get('single-layout'); } elseif (get_post_type() == 'portfolio' && is_single() && mfn_opts_get('single-portfolio-layout')) { // Theme Options | Single - Portfolio $layout = mfn_opts_get('single-portfolio-layout'); } else { // Post Meta $layout = get_post_meta(mfn_ID(), 'mfn-post-layout', true); } switch ($layout) { case 'left-sidebar': $classes = ' with_aside aside_left'; break; case 'right-sidebar': $classes = ' with_aside aside_right'; break; case 'both-sidebars': $classes = ' with_aside aside_both'; $both = true; break; } // demo if ($_GET && key_exists('mfn-s', $_GET)) { if ($_GET['mfn-s']) { $classes = ' with_aside aside_right'; } else { $classes = false; } } } // WooCommerce if (function_exists('is_woocommerce')) { if (is_woocommerce()) { if ($layout == 'both-sidebars') { // Only one sidebar for shop $classes = ' with_aside aside_right'; } elseif (!$layout) { // BeTheme version < 6.4 | DO NOT DELETE if (is_active_sidebar('shop')) { $classes = ' with_aside aside_right'; } } } if (is_product() && mfn_opts_get('shop-sidebar') == 'shop') { $classes = false; } } // bbPress if (function_exists('is_bbpress') && is_bbpress() && is_active_sidebar('forum')) { $classes = ' with_aside aside_right'; } // BuddyPress if (function_exists('is_buddypress') && is_buddypress() && is_active_sidebar('buddy')) { $classes = ' with_aside aside_right'; } // Events Calendar if (function_exists('tribe_is_month') && is_active_sidebar('events')) { if (tribe_is_month() || tribe_is_day() || tribe_is_event() || tribe_is_event_query() || tribe_is_venue()) { $classes = ' with_aside aside_right'; } } // check if has both sidebars if ($has_both) { return $both; } // Page Template: Blank Page, Under Construction if (is_page_template('template-blank.php') || is_page_template('under-construction.php')) { $classes = false; } return $classes; }
public function setSidebarDisplayed($query) { if (tribe_is_event_query() && (!is_single() || tribe_is_showing_all()) && !is_admin()) { $active_filters = $this->get_active_filters(); if (!empty($active_filters)) { $this->sidebarDisplayed = true; } } }
/** * Enqueue the proper PRO scripts as necessary. * * @return void * @author Paul Hughes * @since 3.0 */ public function enqueue_pro_scripts() { if (tribe_is_event_query()) { $resources_url = trailingslashit($this->pluginUrl) . 'resources/'; $path = Tribe_Template_Factory::getMinFile($resources_url . 'tribe-events-pro.js', true); wp_enqueue_script('tribe-events-pro', $path, array('jquery', 'tribe-events-calendar-script'), false, false); $geoloc = TribeEventsGeoLoc::instance(); $data = array('geocenter' => $geoloc->estimate_center_point()); wp_localize_script('tribe-events-pro', 'TribeEventsPro', $data); } }
/** * Enqueue the maps JS in all the views (Needed for the location filter in the Tribe Bar) */ public function scripts() { if (tribe_is_event_query() && !is_single()) { Tribe_PRO_Template_Factory::asset_package('ajax-maps'); } }
/** * Load asset packages. * * @return void */ public function loadStyle() { if (tribe_is_event_query() || tribe_is_event_organizer() || tribe_is_event_venue()) { // jquery-resize Tribe__Events__Template_Factory::asset_package('jquery-resize'); // smoothness Tribe__Events__Template_Factory::asset_package('smoothness'); // Tribe Calendar JS Tribe__Events__Template_Factory::asset_package('calendar-script'); Tribe__Events__Template_Factory::asset_package('events-css'); } else { if (is_active_widget(false, false, 'tribe-events-list-widget')) { Tribe__Events__Template_Factory::asset_package('events-css'); } } }
function tc_is_tec_single_event() { return function_exists('tribe_is_event_query') && tribe_is_event_query() && is_single(); }
/** * Enqueue the proper PRO scripts as necessary. * * @return void */ public function enqueue_pro_scripts() { if (tribe_is_event_query()) { // @TODO filter the tribe_events_resource_url() function $path = Tribe__Events__Pro__Template_Factory::getMinFile(tribe_events_pro_resource_url('tribe-events-pro.js'), true); wp_enqueue_script('tribe-events-pro', $path, array('jquery', 'tribe-events-calendar-script'), apply_filters('tribe_events_pro_js_version', self::VERSION), false); $geoloc = Tribe__Events__Pro__Geo_Loc::instance(); $data = array('geocenter' => $geoloc->estimate_center_point(), 'map_tooltip_event' => __('Event: ', 'tribe-events-calendar-pro'), 'map_tooltip_address' => __('Address: ', 'tribe-events-calendar-pro')); $data = apply_filters('tribe_events_pro_localize_script', $data, 'Tribe__Events__Pro__Main', 'tribe-events-pro'); wp_localize_script('tribe-events-pro', 'TribeEventsPro', $data); } }
function is_tribe_events_page() { return class_exists('TribeEvents') ? tribe_is_event() || tribe_is_event_query() : false; }