本文整理汇总了PHP中tribe_is_week函数的典型用法代码示例。如果您正苦于以下问题:PHP tribe_is_week函数的具体用法?PHP tribe_is_week怎么用?PHP tribe_is_week使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tribe_is_week函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dt_the_events_calendar_template_config
/**
* 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);
}
}
示例2: collapse_sql
/**
* 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";
}
示例3: grve_events_calendar_is_overview
/**
* 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;
}
示例4: filter_events_title
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;
}
示例5: miss_document_title
/**
*
*/
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));
}
//.........这里部分代码省略.........
示例6: setup_datepicker_label
/**
* 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.
*/
public function setup_datepicker_label($caption)
{
if (tribe_is_week()) {
$caption = __('Week Of', 'tribe-events-calendar-pro');
}
return $caption;
}
示例7: tribe_recurring_instances_toggle
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>';
}
}
示例8: miss_page_title
/**
*
*/
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;
//.........这里部分代码省略.........
示例9: is_events_archive
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;
}
}
示例10: addGroupBy
/**
* 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;
}
示例11: fitclub_tribe_alter_event_archive_titles
function fitclub_tribe_alter_event_archive_titles($depth)
{
// Modify the titles here
// Some of these include %1$s and %2$s, these will be replaced with relevant dates
$title_upcoming = esc_html__('Upcoming Events', 'fitclub');
// List View: Upcoming events
$title_past = esc_html__('Past Events', 'fitclub');
// List view: Past events
$title_range = esc_html__('Events for %1$s - %2$s', 'fitclub');
// List view: range of dates being viewed
$title_month = esc_html__('Events for %1$s', 'fitclub');
// Month View, %1$s = the name of the month
$title_day = esc_html__('Events for %1$s', 'fitclub');
// Day View, %1$s = the day
$title_all = esc_html__('All events for %s', 'fitclub');
// showing all recurrences of an event, %s = event title
$title_week = esc_html__('Events for week of %s', 'fitclub');
// Week view
// Don't modify anything below this unless you know what it does
global $wp_query;
$tribe_ecp = Tribe__Events__Main::instance();
$date_format = apply_filters('tribe_events_pro_page_title_date_format', tribe_get_date_format(true));
// Default Title
$title = $title_upcoming;
// 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_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($title_range, $first_event_date, $last_event_date);
} elseif (tribe_is_past()) {
$title = $title_past;
}
// Month view title
if (tribe_is_month()) {
$title = sprintf($title_month, date_i18n(tribe_get_option('monthAndYearFormat', 'F Y'), strtotime(tribe_get_month_view_date())));
}
// Single view title
if (tribe_is_event() && is_single()) {
$title = get_the_title();
}
// Day view title
if (tribe_is_day()) {
$title = sprintf($title_day, date_i18n(tribe_get_date_format(true), strtotime($wp_query->get('start_date'))));
}
// All recurrences of an event
if (function_exists('tribe_is_showing_all') && tribe_is_showing_all()) {
$title = sprintf($title_all, get_the_title());
}
// Week view title
if (function_exists('tribe_is_week') && tribe_is_week()) {
$title = sprintf($title_week, date_i18n($date_format, strtotime(tribe_get_first_week_day($wp_query->get('start_date')))));
}
if (is_tax($tribe_ecp->get_event_taxonomy()) && $depth) {
$cat = get_queried_object();
$title = $cat->name;
}
return $title;
}
示例12: tribe_genesis_event_archive_full_content
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';
}
}
}
示例13: miss_get_breadcrumbs
//.........这里部分代码省略.........
$html .= miss_breadcrumbs_bold(__('Archives for ', MISS_TEXTDOMAIN) . single_month_title(' ', false), $args['bold']);
} elseif (is_year()) {
$html .= miss_breadcrumbs_bold(__('Archives for ', MISS_TEXTDOMAIN) . get_the_time('Y'), $args['bold']);
}
} elseif (is_author()) {
$html .= miss_breadcrumbs_bold(__('Archives by: ', MISS_TEXTDOMAIN) . get_the_author_meta('display_name', $wp_query->post->post_author), $args['bold']);
}
} elseif (miss_is_bp()) {
global $bp;
// we're outside the loop!
//print_r( $bp );
if (isset($bp) && is_object($bp) && isset($bp->current_component)) {
// Assign some variables here
$homeurl = get_bloginfo('url');
$bp_page1 = $bp->members->root_slug;
// bp_get_members_root_slug() // slug for the Members page. The BuddyPress default is 'members'.
$bp_page2 = $bp->groups->root_slug;
// bp_get_groups_root_slug() // slug for the Groups page. The BuddyPress default is 'groups'.
$bp_page3 = $bp->activity->root_slug;
// bp_get_activity_root_slug() // slug for the Activity page. The BuddyPress default is 'activity'.
$bp_page4 = $bp->forums->root_slug;
// bp_get_forums_root_slug() // slug for the Forums page. The BuddyPress default is 'forums'.
//$bp_page5 = $bp->achievements->root_slug; // slug for the Achievements page. The BuddyPress default is 'achievements'.
if (bp_is_group()) {
$html .= $home . $separator . __('Groups', MISS_TEXTDOMAIN);
if (is_404()) {
$html .= $separator . miss_breadcrumbs_bold(__('Not Found', MISS_TEXTDOMAIN), $args['bold']);
}
}
if (bp_is_user() && !bp_is_register_page()) {
$html .= $home . " {$separator} " . '<a href="' . $homeurl . '/' . $bp_page1 . '/">' . ucwords($bp_page1) . '</a>' . " {$separator} " . '<a href="' . $bp->displayed_user->domain . '">' . ucwords($bp->displayed_user->fullname) . '</a>' . " {$divider} " . ucwords($bp->current_component) . "";
}
if (!bp_is_blog_page() && (is_page() || is_page($bp_page1) || is_page($bp_page2) || is_page($bp_page3) || is_page($bp_page4)) && !bp_is_user() && !bp_is_single_item() && !bp_is_register_page()) {
$html .= $home . " {$separator} " . get_the_title() . "";
}
if (bp_is_register_page()) {
$html .= $home . " {$separator} " . get_the_title() . "";
}
if (bp_is_blog_page() && is_home() && $front == "page") {
$html .= "<a href='" . $homeurl . "'>{$home}</a>" . " {$separator} " . $blog . "";
}
if (get_query_var('paged')) {
if (bp_is_blog_page() && !(is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author())) {
$html .= ' (Page' . ' ' . get_query_var('paged') . ')';
}
}
/* $html .= $home . $separator . miss_breadcrumbs_bold( __( 'Search results for "', MISS_TEXTDOMAIN ) . stripslashes( strip_tags( get_search_query() ) ) . '"', $args['bold'] ); */
}
} elseif (is_search()) {
$html .= $home . $separator . miss_breadcrumbs_bold(__('Search results for "', MISS_TEXTDOMAIN) . stripslashes(strip_tags(get_search_query())) . '"', $args['bold']);
} elseif (is_404()) {
$html .= $home . $separator . miss_breadcrumbs_bold(__('Page Not Found', MISS_TEXTDOMAIN), $args['bold']);
} else {
$html = '';
}
if (class_exists('TribeEventsPro')) {
if (class_exists('TribeEvents')) {
$tec = TribeEvents::instance();
$events_page = '<a href="' . home_url('/') . trailingslashit($tec->getOption('eventsSlug', 'events')) . '" title="' . __('Events', MISS_TEXTDOMAIN) . '">' . __('Events', MISS_TEXTDOMAIN) . '</a>';
$html_event = $home . $separator . $events_page;
}
if (function_exists('tribe_is_month') && tribe_is_month()) {
$html = $html_event;
$html .= $separator . __('Events for', MISS_TEXTDOMAIN) . ' ' . Date("F Y", strtotime($wp_query->get('start_date')));
}
if (function_exists('tribe_is_day') && tribe_is_day()) {
$html = $html_event;
$html .= $separator . __('Events for', MISS_TEXTDOMAIN) . ' ' . 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')) {
$html = $html_event;
$html .= $separator . sprintf(__('Events for week of %s', MISS_TEXTDOMAIN), Date("l, F jS Y", strtotime(tribe_get_first_week_day($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()) {
$html = $html_event;
$html .= $separator . __('Past Events', MISS_TEXTDOMAIN);
} else {
$html = $html_event;
$html .= $separator . __('Upcoming Events', MISS_TEXTDOMAIN);
}
}
if (function_exists('tribe_is_showing_all') && tribe_is_showing_all()) {
$html = $html_event;
$html .= $separator . sprintf('%s %s', __('All events for', MISS_TEXTDOMAIN), get_the_title());
}
}
//$breadcrumbs = '<div class="breadcrumb breadcrumbs"><div class="breadcrumbs-plus">';
$breadcrumbs = $args['prefix'];
$breadcrumbs .= $html;
$breadcrumbs .= $args['suffix'];
//$breadcrumbs .= '</div></div>';
$breadcrumbs = apply_filters('miss_get_breadcrumbs', $breadcrumbs);
if (!$args['echo']) {
return $breadcrumbs;
}
echo $breadcrumbs;
}
示例14: recurrence_collapse_sql
/**
* Collapses subsequent recurrence records and ensures the closest record is returned
*
* @param string $sql The current SQL statement
* @param WP_Query $query WP Query object
*
* @return string The new SQL statement
*/
public static function recurrence_collapse_sql($sql, $query)
{
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 (!empty($query->tribe_is_event) || !empty($query->tribe_is_multi_posttype)) {
if (isset($query->query_vars['tribeHideRecurrence']) && $query->query_vars['tribeHideRecurrence']) {
global $wpdb;
// if we are collapsing recurrence events, we need to re-jigger the SQL statement so the GROUP BY
// collapses records in an expected manner
// 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);
// 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 = '';
}
$sql = '
SELECT
SQL_CALC_FOUND_ROWS *
FROM (
' . $sql . "\n\t\t\t\t\t) a\n\t\t\t\t\tGROUP BY IF( post_parent = 0, ID, post_parent )\n\t\t\t\t\tORDER BY EventStartDate ASC\n\t\t\t\t\t{$limit}\n\t\t\t\t";
}
}
return $sql;
}
示例15: dttheme_events_breadcrumb
function dttheme_events_breadcrumb()
{
global $post, $wp_query;
$delimiter = ' class = "fa ' . dttheme_option('general', 'breadcrumb-delimiter') . '"';
$this->options = array('before' => "<span {$delimiter} > ", 'after' => ' </span>');
$markup = $this->options['before'] . $this->options['after'];
echo '<div class="breadcrumb">
<a href="' . home_url() . '">' . __('Home', 'dt_themes') . '</a>';
echo $markup;
echo '<a href="' . tribe_get_events_link() . '">' . __('Events', 'dt_themes') . '</a>';
if (tribe_is_month() && !is_tax()) {
echo $markup;
echo '<span class="current">' . __('Events This Month', 'dt_themes') . '</span>';
} elseif (class_exists('Tribe__Events__Pro__Main') && tribe_is_week()) {
echo $markup;
echo '<span class="current">' . __('Events This Week', 'dt_themes') . '</span>';
} elseif (class_exists('Tribe__Events__Pro__Main') && tribe_is_day()) {
echo $markup;
echo '<span class="current">' . __('Events Today', 'dt_themes') . '</span>';
} elseif (class_exists('Tribe__Events__Pro__Main') && tribe_is_map()) {
echo $markup;
echo '<span class="current">' . __('Upcoming Events', 'dt_themes') . '</span>';
} elseif (class_exists('Tribe__Events__Pro__Main') && tribe_is_photo()) {
echo $markup;
echo '<span class="current">' . __('Upcoming Events', 'dt_themes') . '</span>';
} elseif (tribe_is_list_view()) {
echo $markup;
echo '<span class="current">' . __('Upcoming Events', 'dt_themes') . '</span>';
} elseif (is_single()) {
echo $markup;
$post_title = $wp_query->post->post_title;
echo '<span class="current">' . $post_title . '</span>';
} elseif (tribe_is_month() && is_tax()) {
$term_slug = $wp_query->query_vars['tribe_events_cat'];
$term = get_term_by('slug', $term_slug, 'tribe_events_cat');
$name = $term->name;
echo $markup;
echo '<span class="current">' . $name . '</span>';
} elseif (is_tag()) {
echo $markup;
echo '<span class="current">' . single_tag_title('', FALSE) . '</span>';
}
echo '</div>';
}