/** * 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); } }
/** * Make sure ical link has the date in the URL instead of "today" on day view * * @param $link * * @return string */ public static function day_view_ical_link($link) { if (tribe_is_day()) { global $wp_query; $day = $wp_query->get('start_date'); $link = trailingslashit(esc_url(trailingslashit(tribe_get_day_link($day)) . '?ical=1')); } return $link; }
/** * 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"; }
/** * Helper function to check if is Events Calendar Overview Page */ function grve_events_calendar_is_overview() { if (grve_events_calendar_enabled()) { if (tribe_is_list_view() || tribe_is_day() || tribe_is_month()) { return true; } } if (grve_events_calendar_pro_enabled()) { if (tribe_is_week() || tribe_is_map() || tribe_is_photo()) { return true; } } return false; }
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; }
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_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>'; } } }
/** * 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); }
function fitclub_is_tribe_page() { wp_reset_postdata(); //reset custom query if (class_exists('TRIBE__EVENTS__MAIN')) { if (tribe_is_month() && !is_tax()) { // Month View Page return true; } elseif (tribe_is_month() && is_tax()) { // Month View Category Page return true; } elseif (tribe_is_past() || tribe_is_upcoming() && !is_tax()) { // List View Page return true; } elseif (tribe_is_past() || tribe_is_upcoming() && is_tax()) { // List View Category Page return true; } elseif (tribe_is_day() && !is_tax()) { // Day View Page return true; } elseif (tribe_is_day() && is_tax()) { // Day View Category Page return true; } elseif (tribe_is_event() && is_single()) { // Single Events return true; } } return false; }
/** * Set up the notices for this template * * @return void * @since 3.0 **/ public function set_notices() { global $wp_query; // Look for a search query if (!empty($wp_query->query_vars['s'])) { $search_term = $wp_query->query_vars['s']; } else { if (!empty($_POST['tribe-bar-search'])) { $search_term = $_POST['tribe-bar-search']; } } // Search term based notices if (!empty($search_term) && !have_posts()) { TribeEvents::setNotice('event-search-no-results', sprintf(__('There were no results found for <strong>"%s"</strong>.', 'tribe-events-calendar'), esc_html($search_term))); } else { if (empty($search_term) && empty($wp_query->query_vars['s']) && !have_posts()) { // Messages if currently no events, and no search term $tribe_ecp = TribeEvents::instance(); $is_cat_message = ''; if (is_tax($tribe_ecp->get_event_taxonomy())) { $cat = get_term_by('slug', get_query_var('term'), $tribe_ecp->get_event_taxonomy()); if (tribe_is_upcoming()) { $is_cat_message = sprintf(__('listed under %s. Check out past events for this category or view the full calendar.', 'tribe-events-calendar'), esc_html($cat->name)); } else { if (tribe_is_past()) { $is_cat_message = sprintf(__('listed under %s. Check out upcoming events for this category or view the full calendar.', 'tribe-events-calendar'), esc_html($cat->name)); } } } if (tribe_is_day()) { TribeEvents::setNotice('events-not-found', sprintf(__('No events scheduled for <strong>%s</strong>. Please try another day.', 'tribe-events-calendar'), date_i18n('F d, Y', strtotime(get_query_var('eventDate'))))); } elseif (tribe_is_upcoming()) { $date = date('Y-m-d', strtotime($tribe_ecp->date)); if ($date == date('Y-m-d')) { TribeEvents::setNotice('events-not-found', __('No upcoming events ', 'tribe-events-calendar') . $is_cat_message); } else { TribeEvents::setNotice('events-not-found', __('No matching events ', 'tribe-events-calendar') . $is_cat_message); } } elseif (tribe_is_past()) { TribeEvents::setNotice('events-past-not-found', __('No previous events ', 'tribe-events-calendar') . $is_cat_message); } } } }
/** * 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; }
</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()) { echo 'Events'; } else { echo roots_title(); } } } } } }
/** * 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); }
/** * 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 (tribe_is_day()) { $class = 'Tribe_Events_Day_Template'; } else { if (is_singular(TribeEvents::POSTTYPE)) { $class = 'Tribe_Events_Single_Event_Template'; } } } } // 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)); }
/** * Add classes to events on this view * * @return array * @author Jessica Yazbek * @since 3.0 **/ public function event_classes($classes) { global $post, $wp_query; $classes = array_merge($classes, array('hentry', 'vevent', 'type-tribe_events', 'post-' . $post->ID, 'tribe-clearfix')); $tribe_cat_slugs = tribe_get_event_cat_slugs($post->ID); foreach ($tribe_cat_slugs as $tribe_cat_slug) { $classes[] = 'tribe-events-category-' . $tribe_cat_slug; } if ($venue_id = tribe_get_venue_id($post->ID)) { $classes[] = 'tribe-events-venue-' . $venue_id; } if ($organizer_id = tribe_get_organizer_id($post->ID)) { $classes[] = 'tribe-events-organizer-' . $organizer_id; } // added first class for css if ($wp_query->current_post == 0 && !tribe_is_day()) { $classes[] = 'tribe-events-first'; } // added last class for css if ($wp_query->current_post == $wp_query->post_count - 1) { $classes[] = 'tribe-events-last'; } return $classes; }
public static function get_current_page_template() { $template = ''; if (is_tax(TribeEvents::TAXONOMY)) { if (tribe_is_upcoming() || tribe_is_past()) { $template = TribeEventsTemplates::getTemplateHierarchy('list'); } else { $template = TribeEventsTemplates::getTemplateHierarchy('gridview'); } } // single event if (is_single() && !tribe_is_showing_all()) { $template = TribeEventsTemplates::getTemplateHierarchy('single'); } elseif (tribe_is_upcoming() || tribe_is_past() || tribe_is_day() || is_single() && tribe_is_showing_all()) { $template = TribeEventsTemplates::getTemplateHierarchy('list'); } else { $template = TribeEventsTemplates::getTemplateHierarchy('gridview'); } return apply_filters('tribe_current_events_page_template', $template); }
/** * Adds the Group By that hides future occurences of recurring events if setting is set to. * * * @param string $group_by The current group by clause. * @param $query * * @return string The new group by clause. */ public static function addGroupBy($group_by, $query) { if (tribe_is_month() || tribe_is_week() || tribe_is_day()) { return $group_by; } if (!empty($query->tribe_is_event_query) || !empty($query->tribe_is_multi_posttype)) { if (isset($query->query_vars['tribeHideRecurrence']) && $query->query_vars['tribeHideRecurrence'] == 1) { global $wpdb; $group_by = " IF( {$wpdb->posts}.post_parent = 0, {$wpdb->posts}.ID, {$wpdb->posts}.post_parent )"; } } return $group_by; }
function is_events_archive() { if (class_exists('TribeEvents')) { if (tribe_is_month() || tribe_is_day() || tribe_is_past() || tribe_is_upcoming()) { return true; } else { return false; } } else { return 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; }
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; }
/** * Change the datepicker label, depending on what view the user is on. * * @param string $caption The current caption for the datepicker. * @return string The new caption. * @author Daniel Dvorkin * @since 3.0 */ public function setup_datepicker_label($caption) { if (tribe_is_day()) { $caption = __('Day Of', 'tribe-events-calendar-pro'); } elseif (tribe_is_week()) { $caption = __('Week Of', 'tribe-events-calendar-pro'); } return $caption; }
/** * 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; }
/** * Prints out or returns classes on an event wrapper * * @category Events * @param $event |0 post id or object * @param $echo |true * * @return void or string **/ function tribe_events_event_classes($event = 0, $echo = true) { global $post, $wp_query; // May be called when the global $post object does not exist - ie during ajax loads of various views // ... creating a dummy object allows the method to proceed semi-gracefully (interim measure only) //If $post object doesn't exist and an $event_id wasn't specified, then use a dummy object if (is_a('WP_Post', $event)) { $event_id = $event->ID; } elseif ($event !== 0) { $event_id = $event; } else { $event_id = $post->ID; } if (!$event_id) { return ''; } $classes = array('hentry', 'vevent', 'type-tribe_events', 'post-' . $event_id, 'tribe-clearfix'); $tribe_cat_slugs = tribe_get_event_cat_slugs($event_id); foreach ($tribe_cat_slugs as $tribe_cat_slug) { if (!empty($tribe_cat_slug)) { $classes[] = 'tribe-events-category-' . $tribe_cat_slug; } } if ($venue_id = tribe_get_venue_id($event_id)) { $classes[] = 'tribe-events-venue-' . $venue_id; } if ($organizer_id = tribe_get_organizer_id($event_id)) { $classes[] = 'tribe-events-organizer-' . $organizer_id; } // added first class for css if ($wp_query->current_post == 0 && !tribe_is_day()) { $classes[] = 'tribe-events-first'; } // added last class for css if ($wp_query->current_post == $wp_query->post_count - 1) { $classes[] = 'tribe-events-last'; } $classes = apply_filters('tribe_events_event_classes', $classes); if ($echo) { echo implode(' ', $classes); } else { return implode(' ', $classes); } }
/** * Alter the main page header title text for tribe events * * @since 2.0.0 * @access public */ public function page_header_title($title) { // Fixes issue with search results if (is_search()) { return $title; } // Customize title for event pages if (tribe_is_event_category()) { $title = get_the_archive_title(); } elseif (tribe_is_month()) { $title = esc_html__('Events Calendar', 'total'); } elseif (tribe_is_event() && !tribe_is_day() && !is_single()) { $title = esc_html__('Events List', 'total'); } elseif (tribe_is_day()) { $title = esc_html__('Single Day', 'total'); } /* } elseif ( is_singular( 'tribe_events' ) ) { $title = '<span>'. esc_html__( 'Event:', 'total' ) .'</span> '. get_the_title(); */ // Return title return $title; }
/** * 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)); }
/** * 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) { // 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 (tribe_get_option('hideSubsequentRecurrencesDefault', false) == true || isset($_REQUEST['tribeHideRecurrence']) && $_REQUEST['tribeHideRecurrence'] == '1') { $query->query_vars['tribeHideRecurrence'] = 1; } return $query; }
$sizes = $banner['sizes']; $small = $sizes['small']; $medium = $sizes['medium']; $large = $sizes['large']; } else { if (tribe_is_event() && !tribe_is_day() && !is_single()) { $pageid = jtd_get_id_by_slug('events'); $alt = get_the_title($pageid); $small = wp_get_attachment_image_src(get_post_thumbnail_id($pageid), 'small'); $small = $small[0]; $medium = wp_get_attachment_image_src(get_post_thumbnail_id($pageid), 'medium'); $medium = $medium[0]; $large = wp_get_attachment_image_src(get_post_thumbnail_id($pageid), 'large'); $large = $large[0]; } else { if (tribe_is_event() && tribe_is_day() && !is_single()) { $pageid = jtd_get_id_by_slug('events'); $alt = get_the_title($pageid); $small = wp_get_attachment_image_src(get_post_thumbnail_id($pageid), 'small'); $small = $small[0]; $medium = wp_get_attachment_image_src(get_post_thumbnail_id($pageid), 'medium'); $medium = $medium[0]; $large = wp_get_attachment_image_src(get_post_thumbnail_id($pageid), 'large'); $large = $large[0]; } else { if (tribe_is_event() && is_single()) { $small = wp_get_attachment_image_src(get_post_thumbnail_id(), 'small'); $medium = wp_get_attachment_image_src(get_post_thumbnail_id(), 'medium'); $large = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large'); } else { if (is_tax('tribe_events_cat')) {
function tribe_genesis_event_archive_full_content() { if (class_exists('Tribe__Events__Main') && class_exists('Tribe__Events__Pro__Main')) { if (tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() || tribe_is_map() || tribe_is_photo() || tribe_is_week()) { return 'full'; } } elseif (class_exists('Tribe__Events__Main') && !class_exists('Tribe__Events__Pro__Main')) { if (tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day()) { return 'full'; } } }
/** * */ 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)); }
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; } }