/** * Theme basic config. * * @see https://gist.github.com/jo-snips/2415009 */ function dt_the_events_calendar_template_config() { // detect calendar pages if (tribe_is_month() && !is_tax() || tribe_is_month() && is_tax() || (tribe_is_past() || tribe_is_upcoming() && !is_tax()) || (tribe_is_past() || tribe_is_upcoming() && is_tax()) || tribe_is_day() && !is_tax() || tribe_is_day() && is_tax() || tribe_is_event() && is_single() || tribe_is_venue() || function_exists('tribe_is_week') && tribe_is_week() || function_exists('tribe_is_photo') && tribe_is_photo() || function_exists('tribe_is_map') && tribe_is_map() || get_post_type() == 'tribe_organizer' && is_single()) { // remove theme title controller remove_action('presscore_before_main_container', 'presscore_page_title_controller', 16); } }
/** * Collapses subsequent recurrence records when appropriate (ie, for multi-post type queries where * the "Recurring event instances"/show-only-the-first-upcoming-recurring-event setting is enabled). * * In those situations where we do need to intervene and collapse recurring events, we re-jigger * the SQL statement so the GROUP BY collapses records in the expected manner. * * @param string $sql The current SQL statement * @param WP_Query $query WP Query object * * @return string The new SQL statement */ public static function collapse_sql($sql, $query) { global $wpdb; // For month, week and day views we don't want to apply this logic - unless the current query // belongs to a widget and just happens to be running inside one of those views if (!isset($query->query_vars['is_tribe_widget']) || !$query->query_vars['is_tribe_widget']) { if (tribe_is_month() || tribe_is_week() || tribe_is_day()) { return $sql; } } // If this is not an event query/a multi post type query there is no need to interfere if (empty($query->tribe_is_event) && empty($query->tribe_is_multi_posttype)) { return $sql; } // If the hide-recurring-events setting is not set/is false we do not need to interfere if (!isset($query->query_vars['tribeHideRecurrence']) || !$query->query_vars['tribeHideRecurrence']) { return $sql; } // If looking just for fields then let's replace the .ID with * if ($query->query_vars['fields'] == 'ids') { $sql = preg_replace("/(^SELECT\\s+DISTINCT\\s{$wpdb->posts}.)(ID)/", "\$1*, {$wpdb->postmeta}.meta_value as 'EventStartDate'", $sql); } if ($query->query_vars['fields'] == 'id=>parent') { $sql = preg_replace("/(^SELECT\\s+DISTINCT\\s{$wpdb->posts}.ID,\\s{$wpdb->posts}.post_parent)/", "\$1, {$wpdb->postmeta}.meta_value as 'EventStartDate'", $sql); } // We need to relocate the SQL_CALC_FOUND_ROWS to the outer query $sql = preg_replace('/SQL_CALC_FOUND_ROWS/', '', $sql); // We don't want to grab the min EventStartDate or EventEndDate because without a group by that collapses everything $sql = preg_replace('/MIN\\((' . $wpdb->postmeta . '|tribe_event_end_date).meta_value\\) as Event(Start|End)Date/', '$1.meta_value as Event$2Date', $sql); // Let's get rid of the group by (non-greedily stop before the ORDER BY or LIMIT) $sql = preg_replace('/GROUP BY .+?(ORDER|LIMIT)/', '$1', $sql); // Once this becomes an inner query we need to avoid duplicating the post_date column (which will // otherwise be returned once from wp_posts.* and once as an alias) $sql = str_replace('AS post_date', 'AS EventStartDate', $sql); // The outer query should order things by EventStartDate in the same direction the inner query does by post date: preg_match('/[\\s,](?:EventStartDate|post_date)\\s+(DESC|ASC)/', $sql, $direction); $direction = isset($direction[1]) && 'DESC' === $direction[1] ? 'DESC' : 'ASC'; // Let's extract the LIMIT. We're going to relocate it to the outer query $limit_regex = '/LIMIT\\s+[0-9]+(\\s*,\\s*[0-9]+)?/'; preg_match($limit_regex, $sql, $limit); if ($limit) { $sql = preg_replace($limit_regex, '', $sql); $limit = $limit[0]; } else { $limit = ''; } $group_clause = $query->query_vars['fields'] == 'id=>parent' ? 'GROUP BY ID' : 'GROUP BY IF( post_parent = 0, ID, post_parent )'; return ' SELECT SQL_CALC_FOUND_ROWS * FROM ( ' . $sql . "\n\t\t\t) a\n\t\t\t{$group_clause}\n\t\t\tORDER BY EventStartDate {$direction}\n\t\t\t{$limit}\n\t\t"; }
/** * Set the notices used on month view * * @param array $args Set of $wp_query params for the month view, if none passed then will default to $wp_query * @since 3.0 */ public function __construct($args = null) { if ($args === null) { global $wp_query; $args = $wp_query->query; } self::$args = $args; self::$posts_per_page_limit = apply_filters('tribe_events_month_day_limit', tribe_get_option('monthEventAmount', '3')); if (!tribe_is_month()) { $this->asset_packages = array(); } parent::__construct(); }
function wpv_upcoming_events_title($title) { $upcoming = wpv_get_option('tribe-events-upcoming-title'); $past = wpv_get_option('tribe-events-past-title'); $month = wpv_get_option('tribe-events-month-title'); if (!empty($upcoming) && (tribe_is_upcoming() || function_exists('tribe_is_map') && tribe_is_map() || function_exists('tribe_is_photo') && tribe_is_photo())) { return $upcoming; } elseif (!empty($past) && tribe_is_past()) { return $past; } elseif (!empty($month) && tribe_is_month()) { return sprintf($month, date_i18n(tribe_get_option('monthAndYearFormat', 'F Y'), strtotime(tribe_get_month_view_date()))); } return $title; }
/** * Set the notices used on month view * * @param array $args Set of $wp_query params for the month view, if none passed then will default to $wp_query */ public function __construct($args = null) { if ($args === null) { global $wp_query; $args = $wp_query->query; } self::$args = $args; self::$posts_per_page_limit = apply_filters('tribe_events_month_day_limit', tribe_get_option('monthEventAmount', '3')); // don't enqueue scripts and js when we're not constructing month view, // they'll have to be enqueued separately if (!tribe_is_month()) { $this->asset_packages = array(); } parent::__construct(); }
function filter_events_title($title) { if (tribe_is_month() && !is_tax()) { // Month View Page $title = 'Events - Month view page | Czech and Slovak Club Tauranga'; } elseif (tribe_is_month() && is_tax()) { // Month View Category Page $title = 'Events - Month view category page | Czech and Slovak Club Tauranga'; } elseif (tribe_is_upcoming() && !is_tax()) { // List View Page: Upcoming Events $title = 'Events - Upcoming events page | Czech and Slovak Club Tauranga'; } elseif (tribe_is_upcoming() && is_tax()) { // List View Category Page: Upcoming Events $title = 'Events - Upcoming events page | Czech and Slovak Club Tauranga'; } elseif (tribe_is_past() && !is_tax()) { // List View Page: Past Events $title = 'Events - Past events page | Czech and Slovak Club Tauranga'; } elseif (tribe_is_past() && is_tax()) { // List View Category Page: Past Events $title = 'Events - Category: Past events page | Czech and Slovak Club Tauranga'; } elseif (tribe_is_week() && !is_tax()) { // Week View Page $title = 'Events - Week view page | Czech and Slovak Club Tauranga'; } elseif (tribe_is_week() && is_tax()) { // Week View Category Page $title = 'Events - Week view category page | Czech and Slovak Club Tauranga'; } elseif (tribe_is_day() && !is_tax()) { // Day View Page $title = 'Events - Day view page | Czech and Slovak Club Tauranga'; } elseif (tribe_is_day() && is_tax()) { // Day View Category Page $title = 'Events - Day view category page | Czech and Slovak Club Tauranga'; } elseif (tribe_is_map() && !is_tax()) { // Map View Page $title = 'Events - Map view page | Czech and Slovak Club Tauranga'; } elseif (tribe_is_map() && is_tax()) { // Map View Category Page $title = 'Events - Map view category page | Czech and Slovak Club Tauranga'; } elseif (tribe_is_photo() && !is_tax()) { // Photo View Page $title = 'Events - Photo view page | Czech and Slovak Club Tauranga'; } elseif (tribe_is_photo() && is_tax()) { // Photo View Category Page $title = 'Events - Photo view category page | Czech and Slovak Club Tauranga'; } return $title; }
/** * Set the notices used on month view * * @param array $args Set of $wp_query params for the month view, if none passed then will default to $wp_query */ public function __construct($args = null) { if ($args === null) { global $wp_query; $args = $wp_query->query; if (!empty($wp_query->query_vars['meta_query'])) { $args['meta_query'] = $wp_query->query_vars['meta_query']; } } $this->use_cache = tribe_get_option('enable_month_view_cache', false); // Cache the result of month/content.php if ($this->use_cache) { $cache_expiration = apply_filters('tribe_events_month_view_transient_expiration', HOUR_IN_SECONDS); $this->html_cache = new Tribe__Events__Template_Part_Cache('month/content.php', serialize($args), $cache_expiration, 'save_post'); } self::$args = $args; self::$posts_per_page_limit = apply_filters('tribe_events_month_day_limit', tribe_get_option('monthEventAmount', '3')); // don't enqueue scripts and js when we're not constructing month view, // they'll have to be enqueued separately if (!tribe_is_month()) { $this->asset_packages = array(); } parent::__construct(); }
/** * Generates the markup for the "iCal Import" link for the views. * * @static * * @param string $content * * @return string */ public static function maybe_add_link($content) { global $wp_query; $show_ical = apply_filters('tribe_events_list_show_ical_link', true); if (!$show_ical) { return $content; } if (tribe_is_month() && !tribe_events_month_has_events()) { return $content; } if (is_single() || !have_posts()) { return $content; } $tec = TribeEvents::instance(); $view = $tec->displaying; if (defined('DOING_AJAX') && DOING_AJAX && isset($wp_query->query_vars['eventDisplay'])) { $view = $wp_query->query_vars['eventDisplay']; } switch (strtolower($view)) { case 'month': $modifier = __("Month's Events", "tribe-events-calendar-pro"); break; case 'week': $modifier = __("Week's Events", "tribe-events-calendar-pro"); break; case 'day': $modifier = __("Day's Events", "tribe-events-calendar-pro"); break; default: $modifier = __("Listed Events", "tribe-events-calendar-pro"); break; } $ical = '<a class="tribe-events-ical tribe-events-button" title="' . __('Import is filter/view sensitive', 'tribe-events-calendar-pro') . '" href="' . tribe_get_ical_link() . '">+ ' . __('iCal Import', 'tribe-events-calendar-pro') . ' ' . $modifier . '</a>'; echo $ical; return $content; }
/** * */ function miss_page_title() { global $irish_framework_params, $wp_query; if (is_front_page()) { return; } if (miss_is_template('templates/template-home.php')) { return; } $post_obj = $wp_query->get_queried_object(); if (!empty($post_obj) && !empty($post_obj->ID) && get_post_meta($post_obj->ID, '_disable_page_title', true)) { return; } $title = ''; if (is_404()) { $title = __('The requested page could not be found', MISS_TEXTDOMAIN); $page_tagline = __('Error 404', MISS_TEXTDOMAIN); } /** * Events Calendar PRO Support * * @since 1.8 */ if (class_exists('TribeEventsPro')) { if (function_exists('tribe_is_month') && tribe_is_month()) { $title = __('Events for', MISS_TEXTDOMAIN); $page_tagline = Date("F Y", strtotime($wp_query->get('start_date'))); } if (function_exists('tribe_is_day') && tribe_is_day()) { $title = __('Events for', MISS_TEXTDOMAIN); $page_tagline = Date("l, F jS Y", strtotime($wp_query->get('start_date'))); } if (function_exists('tribe_is_week') && tribe_is_week()) { if (function_exists('tribe_get_first_week_day')) { $title = sprintf(__('Events for week of %s', MISS_TEXTDOMAIN), Date("l, F jS Y", strtotime(tribe_get_first_week_day($wp_query->get('start_date'))))); } $page_tagline = ''; } if (function_exists('tribe_is_map') && tribe_is_map() || function_exists('tribe_is_photo') && tribe_is_photo()) { if (tribe_is_past()) { $title = __('Past Events', MISS_TEXTDOMAIN); } else { $title = __('Upcoming Events', MISS_TEXTDOMAIN); } $page_tagline = ''; } if (function_exists('tribe_is_showing_all') && tribe_is_showing_all()) { $title = sprintf('%s %s', __('All events for', MISS_TEXTDOMAIN), get_the_title()); $page_tagline = ''; } } $intro_options = miss_get_setting('intro_options'); if (is_search()) { $title = sprintf(__('Search Results for: %1$s', MISS_TEXTDOMAIN), '‘' . get_search_query() . '’'); } elseif (is_category()) { $title = sprintf(__('Category Archive for: %1$s', MISS_TEXTDOMAIN), '‘' . single_cat_title('', false) . '’'); } elseif (is_archive() || is_singular('post')) { $title = sprintf(__('%1$s', MISS_TEXTDOMAIN), miss_get_setting(get_post_type() . '_page_caption') ? miss_get_setting(get_post_type() . '_page_caption') : get_post_type()); } elseif (is_tag()) { $title = sprintf(__('All Posts Tagged Tag: %1$s', MISS_TEXTDOMAIN), '‘' . single_tag_title('', false) . '’'); } elseif (is_day()) { $title = sprintf(__('Daily Archive for: %1$s', MISS_TEXTDOMAIN), '‘' . get_the_time('F jS, Y') . '’'); } elseif (is_month()) { $title = sprintf(__('Monthly Archive for: %1$s', MISS_TEXTDOMAIN), '‘' . get_the_time('F, Y') . '’'); } elseif (is_year()) { $title = sprintf(__('Yearly Archive for: %1$s', MISS_TEXTDOMAIN), '‘' . get_the_time('Y') . '’'); } elseif (is_singular('portfolio')) { $gallery_id = miss_get_setting('portfolio_page'); if (!empty($gallery_id)) { $title = get_the_title($gallery_id); } } elseif (function_exists('is_woocommerce') && is_woocommerce()) { $shop_page = get_post(woocommerce_get_page_id('shop')); $title = miss_get_setting('store_title') ? get_option('store_title') : (get_option('woocommerce_shop_page_title') ? get_option('woocommerce_shop_page_title') : __('Store', MISS_TEXTDOMAIN)); $page_tagline = miss_get_setting('product_page_tagline') ? get_option('product_page_tagline') : ''; } elseif (is_author()) { global $author; $curauth = get_userdata(intval($author)); $title = sprintf(__('Author Archive for: %1$s', MISS_TEXTDOMAIN), '‘' . $curauth->nickname . '’'); if (is_search()) { $title = printf(__('Search Results: “%s”', MISS_TEXTDOMAIN), get_search_query()); } elseif (is_tax()) { $title = single_term_title("", false); } else { $shop_page = get_post(woocommerce_get_page_id('shop')); $title = miss_get_setting('store_title') ? get_option('store_title') : (get_option('woocommerce_shop_page_title') ? get_option('woocommerce_shop_page_title') : __('Store', MISS_TEXTDOMAIN)); $page_tagline = miss_get_setting('product_page_tagline') ? get_option('product_page_tagline') : ''; } } if (!empty($title)) { if (!empty($page_tagline)) { $page_tagline = '<span class="page_tagline">' . $page_tagline . '</span>'; $title .= $page_tagline; } return '<h1 class="page_title">' . $title . '</h1>'; } else { global $wp_query; $post_obj = $wp_query->get_queried_object(); $post_id = is_object($post_obj) && isset($post_obj->ID) ? $post_obj->ID : ''; $page_title = get_the_title($post_id); if (empty($page_title)) { return false; } $_layout = get_post_meta($post_id, '_intro_text', true); $template = get_post_meta($post_id, '_wp_page_template', true); if (!isset($page_tagline)) { $page_tagline = get_post_meta($post_id, '_page_tagline', true); } if (!empty($page_tagline)) { $page_tagline = '<span class="page_tagline">' . $page_tagline . '</span>'; } else { $page_tagline = ''; } if (is_page()) { if (is_front_page() != 1 || $template != 'templates/template-home.php') { return the_title('<h1 class="page_title">', $page_tagline . '</h1>', false); } elseif ($_layout == 'default' && $intro_options == 'disable' && $template != 'templates/template-wiki.php') { return the_title('<h1 class="page_title">', $page_tagline . '</h1>', false); } } else { return '<h1 class="page_title">' . get_the_title($post_id) . $page_tagline . '</h1>'; } } }
/** * Get the correct internal page template * * @return string Template class */ public static function get_current_template_class() { $class = ''; // list view if (tribe_is_list_view() || tribe_is_showing_all() || tribe_is_ajax_view_request('list')) { $class = 'Tribe__Events__Template__List'; } elseif (tribe_is_month() || tribe_is_ajax_view_request('month')) { $class = 'Tribe__Events__Template__Month'; } elseif (tribe_is_day() || tribe_is_ajax_view_request('day')) { $class = 'Tribe__Events__Template__Day'; } elseif (is_singular(Tribe__Events__Main::POSTTYPE)) { $class = 'Tribe__Events__Template__Single_Event'; } // apply filters // @todo remove deprecated filter in 3.4 return apply_filters('tribe_events_current_template_class', apply_filters('tribe_current_events_template_class', $class)); }
/** * Get the correct internal page template * * @return string Template class */ public static function get_current_template_class() { $class = ''; // list view if (tribe_is_list_view() || tribe_is_showing_all()) { $class = 'Tribe_Events_List_Template'; } else { if (tribe_is_month()) { $class = 'Tribe_Events_Month_Template'; } else { if (is_singular(TribeEvents::POSTTYPE)) { $class = 'Tribe_Events_Single_Event_Template'; } } } // apply filters return apply_filters('tribe_current_events_template_class', $class); }
<?php if (is_category() or is_tax()) { ?> <div class="tagline"> <?php echo category_description(); ?> </div> <?php } ?> <h1> <?php if (tribe_is_month()) { echo 'Events'; } else { if (tribe_is_event() && !tribe_is_day() && !is_single()) { echo 'Events'; } else { if (is_singular('tribe_events')) { echo 'Events'; } else { if (tribe_is_day()) { echo 'Events'; } else { if (tribe_is_upcoming()) { echo 'Events'; } else { if (tribe_is_past()) {
/** * Set up the date search in the tribe events bar. * * @param array $filters The current filters in the bar array. * * @return array The modified filters array. */ public function setup_date_search_in_bar($filters) { global $wp_query; $value = apply_filters('tribe-events-bar-date-search-default-value', ''); if (!empty($_REQUEST['tribe-bar-date'])) { $value = $_REQUEST['tribe-bar-date']; } $caption = __('Date', 'the-events-calendar'); if (tribe_is_month()) { $caption = sprintf(__('%s In', 'the-events-calendar'), $this->plural_event_label); } elseif (tribe_is_list_view()) { $caption = sprintf(__('%s From', 'the-events-calendar'), $this->plural_event_label); } elseif (tribe_is_day()) { $caption = __('Day Of', 'the-events-calendar'); $value = date(Tribe__Events__Date_Utils::DBDATEFORMAT, strtotime($wp_query->query_vars['eventDate'])); } $caption = apply_filters('tribe_bar_datepicker_caption', $caption); $filters['tribe-bar-date'] = array('name' => 'tribe-bar-date', 'caption' => $caption, 'html' => '<input type="text" name="tribe-bar-date" style="position: relative;" id="tribe-bar-date" value="' . esc_attr($value) . '" placeholder="' . esc_attr__('Date', 'the-events-calendar') . '"><input type="hidden" name="tribe-bar-date-day" id="tribe-bar-date-day" class="tribe-no-param" value="">'); return $filters; }
public function setReccuringEventDates($post) { if (function_exists('tribe_is_recurring_event') && is_singular(self::POSTTYPE) && tribe_is_recurring_event() && !tribe_is_showing_all() && !tribe_is_upcoming() && !tribe_is_past() && !tribe_is_month() && !tribe_is_by_date()) { $startTime = get_post_meta($post->ID, '_EventStartDate', true); $startTime = TribeDateUtils::timeOnly($startTime); $post->EventStartDate = TribeDateUtils::addTimeToDate($this->date, $startTime); $post->EventEndDate = date(TribeDateUtils::DBDATETIMEFORMAT, strtotime($post->EventStartDate) + get_post_meta($post->ID, '_EventDuration', true)); } }
<?php global $avia_config; /* * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory. */ get_header(); $title = tribe_is_month() ? __('Calendar of Events', 'avia_framework') : tribe_get_events_title(false); $args = array('title' => $title, 'link' => ''); if (!is_singular() || get_post_meta(get_the_ID(), 'header', true) != 'no') { echo avia_title($args); } ?> <div class='container_wrap container_wrap_first main_color fullsize'> <div class='container'> <main class='template-page template-event-page content av-content-full units' <?php avia_markup_helper(array('context' => 'content', 'post_type' => 'page')); ?> > <div id="tribe-events-pg-template"> <?php tribe_events_before_html(); tribe_get_view(); tribe_events_after_html(); ?>
/** * 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'); }
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; }
function tribe_recurring_instances_toggle($postId = null) { $hide_recurrence = !empty($_REQUEST['tribeHideRecurrence']) && $_REQUEST['tribeHideRecurrence'] == '1' || empty($_REQUEST['tribeHideRecurrence']) && empty($_REQUEST['action']) && tribe_get_option('hideSubsequentRecurrencesDefault', false) ? '1' : false; if (!tribe_is_week() && !tribe_is_month()) { echo '<span class="tribe-events-user-recurrence-toggle">'; echo '<label for="tribeHideRecurrence">'; echo '<input type="checkbox" name="tribeHideRecurrence" value="1" id="tribeHideRecurrence" ' . checked($hide_recurrence, 1, false) . '>' . __('Show only the first upcoming instance of recurring events', 'tribe-events-calendar-pro'); echo '</label>'; echo '</span>'; } }
/** * Set the notices used on month view. * * @param array $args Set of $wp_query params for the month view, if none passed then will default to $wp_query. */ public function __construct($args = array()) { // set the proper query args $this->set_args($args); // include child categories in the query, save categories for reuse $this->set_queried_event_cats(); // decide if we should use the month view cache $this->use_cache = tribe_get_option('enable_month_view_cache', false); // Cache the result of month/content.php if ($this->use_cache) { $cache_expiration = apply_filters('tribe_events_month_view_transient_expiration', HOUR_IN_SECONDS); $this->html_cache = new Tribe__Template_Part_Cache('month/content.php', serialize($this->args), $cache_expiration, 'save_post'); } $this->events_per_day = apply_filters('tribe_events_month_day_limit', tribe_get_option('monthEventAmount', '3')); $this->requested_date = $this->requested_date(); $this->first_grid_date = self::calculate_first_cell_date($this->requested_date); $this->final_grid_date = self::calculate_final_cell_date($this->requested_date); // get all the ids for the events in this month, speeds up queries $this->set_events_in_month(); // don't enqueue scripts and js when we're not constructing month view, // they'll have to be enqueued separately if (!tribe_is_month()) { $this->asset_packages = array(); } parent::__construct(); }
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; }
/** * 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); }
/** * @deprecated */ function sp_is_month() { _deprecated_function(__FUNCTION__, '2.0', 'tribe_is_month()'); return tribe_is_month(); }
} } } } } } ?> </h1> <?php if (is_single()) { $subtitle = types_render_field("subtitle", array("raw" => "true")); if (!empty($subtitle)) { echo "<h2 class='subtitle'>{$subtitle}</h2>"; } } if (tribe_is_month() || tribe_is_list_view()) { tribe_get_template_part('modules/bar'); } ?> </header> </div> <!-- end left block --> <?php } ?> <nav role="navigation" class="site-navigation"> <div class="home-page-link"><a href="<?php echo esc_url(home_url('/')); ?> " class="icon-home"><span>Home</span></a></div> <h1 class="assistive-text icon-menu"><span>Menu</span></h1> <div class="assistive-text skip-link"><a href="#content" title="Skip to content">Skip to content</a></div>
function is_events_archive() { if (class_exists('Tribe__Events__Main')) { return tribe_is_month() || tribe_is_day() || tribe_is_past() || tribe_is_upcoming() || class_exists('Tribe__Events__Pro__Main') && (tribe_is_week() || tribe_is_photo() || tribe_is_map()) ? true : false; } else { return false; } }
/** * Generates the iCal file * * @static * * @param int|null $post If you want the ical file for a single event */ public static function generate_ical_feed($post = null) { $tec = Tribe__Events__Main::instance(); $events = ''; $blogHome = get_bloginfo('url'); $blogName = get_bloginfo('name'); if ($post) { $events_posts = is_array($post) ? $post : array($post); } else { if (tribe_is_month()) { $events_posts = self::get_month_view_events(); } else { global $wp_query; $events_posts = $wp_query->posts; } } $event_ids = wp_list_pluck($events_posts, 'ID'); foreach ($events_posts as $event_post) { // add fields to iCal output $item = array(); $full_format = 'Ymd\\THis'; $time = (object) array('start' => self::wp_strtotime($event_post->EventStartDate), 'end' => self::wp_strtotime($event_post->EventEndDate), 'modified' => self::wp_strtotime($event_post->post_modified), 'created' => self::wp_strtotime($event_post->post_date)); if ('yes' == get_post_meta($event_post->ID, '_EventAllDay', true)) { $type = 'DATE'; $format = 'Ymd'; } else { $type = 'DATE-TIME'; $format = $full_format; } $tzoned = (object) array('start' => date($format, $time->start), 'end' => date($format, $time->end), 'modified' => date($format, $time->modified), 'created' => date($format, $time->created)); if ('DATE' === $type) { $item[] = "DTSTART;VALUE={$type}:" . $tzoned->start; $item[] = "DTEND;VALUE={$type}:" . $tzoned->end; } else { $tz = get_option('timezone_string'); $item[] = 'DTSTART;TZID="' . $tz . '":' . $tzoned->start; $item[] = 'DTEND;TZID="' . $tz . '":' . $tzoned->end; } $item[] = 'DTSTAMP:' . date($full_format, time()); $item[] = 'CREATED:' . $tzoned->created; $item[] = 'LAST-MODIFIED:' . $tzoned->modified; $item[] = 'UID:' . $event_post->ID . '-' . $time->start . '-' . $time->end . '@' . parse_url(home_url('/'), PHP_URL_HOST); $item[] = 'SUMMARY:' . str_replace(array(',', "\n", "\r", "\t"), array('\\,', '\\n', '', '\\t'), html_entity_decode(strip_tags($event_post->post_title), ENT_QUOTES)); $item[] = 'DESCRIPTION:' . str_replace(array(',', "\n", "\r", "\t"), array('\\,', '\\n', '', '\\t'), html_entity_decode(strip_tags($event_post->post_content), ENT_QUOTES)); $item[] = 'URL:' . get_permalink($event_post->ID); // add location if available $location = $tec->fullAddressString($event_post->ID); if (!empty($location)) { $str_location = str_replace(array(',', "\n"), array('\\,', '\\n'), html_entity_decode($location, ENT_QUOTES)); $item[] = 'LOCATION:' . $str_location; } // add geo coordinates if available if (class_exists('Tribe__Events__Pro__Geo_Loc')) { $long = Tribe__Events__Pro__Geo_Loc::instance()->get_lng_for_event($event_post->ID); $lat = Tribe__Events__Pro__Geo_Loc::instance()->get_lat_for_event($event_post->ID); if (!empty($long) && !empty($lat)) { $item[] = sprintf('GEO:%s;%s', $lat, $long); $str_title = str_replace(array(',', "\n"), array('\\,', '\\n'), html_entity_decode(tribe_get_address($event_post->ID), ENT_QUOTES)); if (!empty($str_title) && !empty($str_location)) { $item[] = 'X-APPLE-STRUCTURED-LOCATION;VALUE=URI;X-ADDRESS=' . str_replace('\\,', '', trim($str_location)) . ';' . 'X-APPLE-RADIUS=500;' . 'X-TITLE=' . trim($str_title) . ':geo:' . $long . ',' . $lat; } } } // add categories if available $event_cats = (array) wp_get_object_terms($event_post->ID, Tribe__Events__Main::TAXONOMY, array('fields' => 'names')); if (!empty($event_cats)) { $item[] = 'CATEGORIES:' . html_entity_decode(join(',', $event_cats), ENT_QUOTES); } // add featured image if available if (has_post_thumbnail($event_post->ID)) { $thumbnail_id = get_post_thumbnail_id($event_post->ID); $thumbnail_url = wp_get_attachment_url($thumbnail_id); $thumbnail_mime_type = get_post_mime_type($thumbnail_id); $item[] = apply_filters('tribe_ical_feed_item_thumbnail', sprintf('ATTACH;FMTTYPE=%s:%s', $thumbnail_mime_type, $thumbnail_url), $event_post->ID); } // add organizer if available $organizer_email = tribe_get_organizer_email($event_post->ID); if ($organizer_email) { $organizer_id = tribe_get_organizer_id($event_post->ID); $organizer = get_post($organizer_id); if ($organizer_id) { $item[] = sprintf('ORGANIZER;CN="%s":MAILTO:%s', rawurlencode($organizer->post_title), $organizer_email); } else { $item[] = sprintf('ORGANIZER:MAILTO:%s', $organizer_email); } } $item = apply_filters('tribe_ical_feed_item', $item, $event_post); $events .= "BEGIN:VEVENT\r\n" . implode("\r\n", $item) . "\r\nEND:VEVENT\r\n"; } header('Content-type: text/calendar; charset=UTF-8'); header('Content-Disposition: attachment; filename="ical-event-' . implode($event_ids) . '.ics"'); $content = "BEGIN:VCALENDAR\r\n"; $content .= "VERSION:2.0\r\n"; $content .= 'PRODID:-//' . $blogName . ' - ECPv' . Tribe__Events__Main::VERSION . "//NONSGML v1.0//EN\r\n"; $content .= "CALSCALE:GREGORIAN\r\n"; $content .= "METHOD:PUBLISH\r\n"; $content .= 'X-WR-CALNAME:' . apply_filters('tribe_ical_feed_calname', $blogName) . "\r\n"; $content .= 'X-ORIGINAL-URL:' . $blogHome . "\r\n"; $content .= 'X-WR-CALDESC:Events for ' . $blogName . "\r\n"; $content = apply_filters('tribe_ical_properties', $content); $content .= $events; $content .= 'END:VCALENDAR'; echo $content; exit; }
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; }
/** * Sets up to add the query variable for hiding subsequent recurrences of recurring events on the frontend. * * @param WP_Query $query The current query object. * * @return WP_Query The modified query object. */ public function setup_hide_recurrence_in_query($query) { if (!isset($query->query_vars['is_tribe_widget']) || !$query->query_vars['is_tribe_widget']) { // don't hide any recurrences on the all recurrences view if (tribe_is_showing_all() || tribe_is_week() || tribe_is_month() || tribe_is_day()) { return $query; } } // don't hide any recurrences in the admin if (is_admin() && !(defined('DOING_AJAX') && DOING_AJAX)) { return $query; } // don't override an explicitly passed value if (isset($query->query_vars['tribeHideRecurrence'])) { return $query; } // if the admin option is set to hide recurrences, or the user option is set if ($this->should_hide_recurrence($query)) { $query->query_vars['tribeHideRecurrence'] = 1; } return $query; }
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>'; }
/** * */ function miss_document_title() { global $page, $paged, $wp_query; /* Set up some default variables. */ $domain = MISS_TEXTDOMAIN; $doctitle = get_bloginfo('name'); $separator = ' | '; $description = get_bloginfo('description', 'display'); //$doctitle = get_bloginfo( 'name' ); /* If viewing the front page and posts page of the site. */ if (is_front_page() && is_home() && !is_singular()) { if ($description != "") { $doctitle = $description; } else { $separator = ''; } } /* If viewing the posts page or a singular post. */ if (is_home() || is_singular()) { $post_id = $wp_query->get_queried_object_id(); $prefix = get_post_meta($post_id, 'Title', true); if (empty($prefix) && is_front_page()) { $prefix = get_bloginfo('name'); } elseif (empty($prefix)) { $prefix = get_post_field('post_title', $post_id); } } elseif (is_archive()) { /* If viewing a taxonomy term archive. */ if (is_category() || is_tag() || is_tax()) { $term = $wp_query->get_queried_object(); $prefix = $term->name; } elseif (function_exists('is_post_type_archive') && is_post_type_archive()) { $post_type = get_post_type_object(get_query_var('post_type')); $prefix = miss_get_setting(get_post_type() . '_page_caption') ? miss_get_setting(get_post_type() . '_page_caption') : $post_type->labels->name; } elseif (is_author()) { $prefix = get_the_author_meta('display_name', get_query_var('author')); } elseif (is_date()) { if (get_query_var('minute') && get_query_var('hour')) { $prefix = sprintf(__('Archive for %1$s', MISS_TEXTDOMAIN), get_the_time(__('g:i a', MISS_TEXTDOMAIN))); } elseif (get_query_var('minute')) { $prefix = sprintf(__('Archive for minute %1$s', MISS_TEXTDOMAIN), get_the_time(__('i', MISS_TEXTDOMAIN))); } elseif (get_query_var('hour')) { $prefix = sprintf(__('Archive for %1$s', MISS_TEXTDOMAIN), get_the_time(__('g a', MISS_TEXTDOMAIN))); } elseif (is_day()) { $prefix = sprintf(__('Archive for %1$s', MISS_TEXTDOMAIN), get_the_time(__('F jS, Y', MISS_TEXTDOMAIN))); } elseif (get_query_var('w')) { $prefix = sprintf(__('Archive for week %1$s of %2$s', MISS_TEXTDOMAIN), get_the_time(__('W', MISS_TEXTDOMAIN)), get_the_time(__('Y', MISS_TEXTDOMAIN))); } elseif (is_month()) { $prefix = sprintf(__('Archive for %1$s', MISS_TEXTDOMAIN), single_month_title(' ', false)); } elseif (is_year()) { $prefix = sprintf(__('Archive for %1$s', MISS_TEXTDOMAIN), get_the_time(__('Y', MISS_TEXTDOMAIN))); } } } elseif (is_search()) { $prefix = sprintf(__('Search results for "%1$s"', MISS_TEXTDOMAIN), esc_attr(get_search_query())); } elseif (is_404()) { $prefix = __('404 Not Found', MISS_TEXTDOMAIN); } elseif (function_exists('bp_is_activity_component') && bp_is_activity_component()) { $prefix = __('Activity', MISS_TEXTDOMAIN); } elseif (function_exists('bp_is_group') && bp_is_group()) { $prefix = __('Group', MISS_TEXTDOMAIN); } /** * Events Calendar PRO Support * * @since 1.8 */ if (class_exists('TribeEventsPro')) { if (function_exists('tribe_is_month') && tribe_is_month()) { $prefix = __('Events for', MISS_TEXTDOMAIN); $prefix .= Date("F Y", strtotime($wp_query->get('start_date'))); } if (function_exists('tribe_is_day') && tribe_is_day()) { $prefix = __('Events for', MISS_TEXTDOMAIN); $prefix .= Date("l, F jS Y", strtotime($wp_query->get('start_date'))); } if (function_exists('tribe_is_week') && tribe_is_week()) { if (function_exists('tribe_get_first_week_day')) { $prefix = sprintf(__('Events for week of %s', MISS_TEXTDOMAIN), Date("l, F jS Y", strtotime(tribe_get_first_week_day($wp_query->get('start_date'))))); } //$page_tagline = Date("l, F jS Y", strtotime($wp_query->get('start_date') ) ); } if (function_exists('tribe_is_map') && tribe_is_map() || function_exists('tribe_is_photo') && tribe_is_photo()) { if (tribe_is_past()) { $prefix = __('Past Events', MISS_TEXTDOMAIN); } else { $prefix = __('Upcoming Events', MISS_TEXTDOMAIN); } } if (function_exists('tribe_is_showing_all') && tribe_is_showing_all()) { $prefix = sprintf('%s %s', __('All events for', MISS_TEXTDOMAIN), get_the_title()); } } /* If the current page is a paged page. */ if ((($page = $wp_query->get('paged')) || ($page = $wp_query->get('page'))) && $page > 1) { $prefix = sprintf(__('%1$sPage %2$s', MISS_TEXTDOMAIN), $prefix . $separator, number_format_i18n($page)); } if (is_front_page()) { $doctitle = $doctitle . $separator . $description; } else { $doctitle = $prefix . $separator . $doctitle; } /* Apply the wp_title filters so we're compatible with plugins. */ $doctitle = apply_filters('wp_title', $doctitle, '', ''); /* Return the title to the screen. */ return apply_atomic('document_title', esc_attr($doctitle)); }
/** * Set up the date search in the tribe events bar. * * @param array $filters The current filters in the bar array. * @return array The modified filters array. */ public function setup_date_search_in_bar($filters) { $value = apply_filters('tribe-events-bar-date-search-default-value', ''); if (!empty($_REQUEST['tribe-bar-date'])) { $value = $_REQUEST['tribe-bar-date']; } $caption = __('Date', 'tribe-events-calendar'); if (tribe_is_month()) { $caption = __('Events In', 'tribe-events-calendar'); } elseif (tribe_is_upcoming() || tribe_is_past()) { $caption = __('Events From', 'tribe-events-calendar'); } $caption = apply_filters('tribe_bar_datepicker_caption', $caption); $filters['tribe-bar-date'] = array('name' => 'tribe-bar-date', 'caption' => $caption, 'html' => '<input type="text" name="tribe-bar-date" style="position: relative;" id="tribe-bar-date" value="' . esc_attr($value) . '" placeholder="' . __('Date', 'tribe-events-calendar') . '"> <input type="hidden" name="tribe-bar-date-day" id="tribe-bar-date-day" class="tribe-no-param" value="">'); return $filters; }