本文整理汇总了PHP中tribe_is_month函数的典型用法代码示例。如果您正苦于以下问题:PHP tribe_is_month函数的具体用法?PHP tribe_is_month怎么用?PHP tribe_is_month使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tribe_is_month函数的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: __construct
/**
* 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();
}
示例4: wpv_upcoming_events_title
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;
}
示例5: __construct
/**
* 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();
}
示例6: 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;
}
示例7: __construct
/**
* 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();
}
示例8: maybe_add_link
/**
* 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;
}
示例9: 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;
//.........这里部分代码省略.........
示例10: get_current_template_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() || 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));
}
示例11: get_current_template_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);
}
示例12: category_description
<?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()) {
示例13: setup_date_search_in_bar
/**
* 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;
}
示例14: setReccuringEventDates
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));
}
}
示例15: get_header
<?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();
?>