本文整理汇总了PHP中tribe_is_event函数的典型用法代码示例。如果您正苦于以下问题:PHP tribe_is_event函数的具体用法?PHP tribe_is_event怎么用?PHP tribe_is_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tribe_is_event函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: is_valid
/**
* Recurrence validation method. This is checked after saving an event, but before splitting a series out into
* multiple occurrences
*
* @param int $event_id The event object that is being saved
* @param array $recurrence_meta Recurrence information for this event
*
* @return bool
*/
public function is_valid($event_id, array $recurrence_meta)
{
$response = (object) array('valid' => true, 'message' => '');
$this->event_id = $event_id;
$this->recurrence_meta = $recurrence_meta;
if (!tribe_is_event($event_id)) {
$response->valid = false;
$response->message = __('Not an event post.', 'tribe-events-calendar-pro');
return $this->filtered_response($response);
}
try {
$this->ensure_not_empty();
if ($this->is_custom()) {
$this->ensure_custom_type();
$this->ensure_all_data();
if ($this->is_monthly()) {
$this->ensure_monthly_day_and_number();
} else {
if ($this->is_yearly()) {
$this->ensure_yearly_day();
}
}
}
} catch (RuntimeException $e) {
$response->valid = false;
$response->message = $e->getMessage();
}
return $this->filtered_response($response);
}
示例2: 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);
}
}
示例3: user_update
public function user_update()
{
if (!tribe_is_event($this->event_id)) {
return;
}
$notice = __('Recurring event data is still being generated for this event. Don’t worry, you can safely navigate away – the process will resume in a bit in the background.', 'tribe-events-pro');
$percent = $this->sanitize_progress($this->queue->progress_percentage());
$spinner = '<img src="' . get_admin_url(null, '/images/spinner.gif') . '">';
$indicator = '<div> <div class="progress" title="' . sprintf(__('%d%% complete', 'tribe-events-pro'), $percent) . '"> <div class="bar"></div> </div>' . $spinner . '</div>';
return "<p> {$notice} </p> {$indicator}";
}
示例4: tribe_get_recurrence_ical_link
/**
* Returns the link to export the whole recurring series in iCal format.
*
* @param int|WP_Pos|null $event_id A event post object, an event post ID or null to use the globally defined post object.
*
* @return string The absolute URL to export the whole recurring series in iCal format.
*/
function tribe_get_recurrence_ical_link($event_id = null)
{
$event_id = Tribe__Events__Main::postIdHelper($event_id);
if (empty($event_id) || !tribe_is_event($event_id)) {
return '';
}
$event = get_post($event_id);
$parent_id = empty($event->post_parent) ? $event_id : $event->post_parent;
$url = get_permalink($parent_id);
$url_vars = array('ical' => '1');
if (tribe_is_recurring_event($parent_id)) {
$child_events_ids = tribe_get_events(array('fields' => 'ids', 'post_parent' => $parent_id));
$event_ids = array_merge(array($parent_id), $child_events_ids);
$url_vars['event_ids'] = implode(',', $event_ids);
}
$url = add_query_arg($url_vars, $url);
return apply_filters('tribe_get_recurrence_ical_link', $url, $event_id);
}
示例5: get_event_costs
/**
* fetches an event's cost values
*
* @param int|WP_Post $event The Event post object or event ID
*
* @return array
*/
public function get_event_costs($event)
{
$event = get_post($event);
if (!is_object($event) || !$event instanceof WP_Post) {
return array();
}
if (!tribe_is_event($event->ID)) {
return array();
}
$costs = tribe_get_event_meta($event->ID, '_EventCost', false);
$parsed_costs = array();
foreach ($costs as $index => $value) {
if ('' === $value) {
continue;
}
$parsed_costs += $this->parse_cost_range($value);
}
return $parsed_costs;
}
示例6: tribe_get_embedded_map
/**
* Google Map Embed
*
* Returns an embedded google maps for an event
*
* @param string $postId
* @param int $width
* @param int $height
* @param bool $force_load If true, then load the map even if an address is not provided.
* @return string An iframe pulling http://maps.google.com/ for this event
* @since 2.0
*/
function tribe_get_embedded_map($postId = null, $width = '', $height = '', $force_load = false)
{
$postId = TribeEvents::postIdHelper($postId);
if (!tribe_is_venue($postId) && !tribe_is_event($postId)) {
return false;
}
$postId = tribe_is_venue($postId) ? $postId : tribe_get_venue_id($postId);
$locationMetaSuffixes = array('address', 'city', 'state', 'province', 'zip', 'country');
$toUrlEncode = "";
foreach ($locationMetaSuffixes as $val) {
$metaVal = call_user_func('tribe_get_' . $val);
if ($metaVal) {
$toUrlEncode .= $metaVal . " ";
}
}
if ($toUrlEncode) {
$address = $toUrlEncode;
} else {
$address = null;
}
if (!$height) {
$height = tribe_get_option('embedGoogleMapsHeight', '350');
}
if (!$width) {
$width = tribe_get_option('embedGoogleMapsWidth', '100%');
}
if ($address || $force_load) {
ob_start();
include TribeEvents::instance()->pluginPath . 'admin-views/event-map.php';
$google_map = ob_get_contents();
ob_get_clean();
return $google_map;
} else {
return '';
}
}
示例7: hijackContentInMainLoop
/**
* Filters the_content to show the event when we are in the main loop and showing events
*
* @param string $content
* @return string Filtered content
* @since 2.1
*/
public static function hijackContentInMainLoop($content)
{
// only run once!!!
remove_filter('the_content', array(__CLASS__, 'hijackContentInMainLoop'));
global $post;
if (tribe_is_in_main_loop() && tribe_is_event($post->ID)) {
ob_start();
echo stripslashes(tribe_get_option('tribeEventsBeforeHTML'));
include_once self::getTemplateHierarchy('in-loop');
echo stripslashes(tribe_get_option('tribeEventsAfterHTML'));
$content = ob_get_contents();
ob_end_clean();
}
return $content;
}
示例8: tribe_event_in_category
/**
* Event in Category Conditional
*
* Returns true if the event is in the specified category slug
*
* @category Events
* @param string $event_cat_slug
* @param int $event_id
*
* @return boolean
*/
function tribe_event_in_category($event_cat_slug, $event_id = null)
{
if (empty($event_id)) {
$event_id = get_the_ID();
}
$term = term_exists($event_cat_slug, Tribe__Events__Main::TAXONOMY);
if (tribe_is_event($event_id) && is_object_in_term($event_id, Tribe__Events__Main::TAXONOMY, array($term['term_id']))) {
$return = true;
} else {
$return = false;
}
return apply_filters('tribe_event_in_category', $return);
}
示例9: avada_get_page_title_bar_contents
function avada_get_page_title_bar_contents($post_id, $get_secondary_content = TRUE)
{
if ($get_secondary_content) {
ob_start();
if (fusion_get_option('page_title_bar_bs', 'page_title_breadcrumbs_search_bar', $post_id) != 'none') {
if ('Breadcrumbs' == Avada()->settings->get('page_title_bar_bs') && in_array(get_post_meta($post_id, 'pyre_page_title_breadcrumbs_search_bar', true), array('breadcrumbs', 'default', '')) || 'breadcrumbs' == get_post_meta($post_id, 'pyre_page_title_breadcrumbs_search_bar', true)) {
fusion_breadcrumbs();
} elseif ('Search Box' == Avada()->settings->get('page_title_bar_bs') && in_array(get_post_meta($post_id, 'pyre_page_title_breadcrumbs_search_bar', true), array('searchbar', 'default', '')) || 'searchbar' == get_post_meta($post_id, 'pyre_page_title_breadcrumbs_search_bar', true)) {
get_search_form();
}
}
$secondary_content = ob_get_contents();
ob_get_clean();
} else {
$secondary_content = '';
}
$title = '';
$subtitle = '';
if ('' != get_post_meta($post_id, 'pyre_page_title_custom_text', true)) {
$title = get_post_meta($post_id, 'pyre_page_title_custom_text', true);
}
if ('' != get_post_meta($post_id, 'pyre_page_title_custom_subheader', true)) {
$subtitle = get_post_meta($post_id, 'pyre_page_title_custom_subheader', true);
}
if ('' == get_post_meta($post_id, 'pyre_page_title_text', true) || 'default' == get_post_meta($post_id, 'pyre_page_title_text', true)) {
$page_title_text = Avada()->settings->get('page_title_bar_text');
} else {
$page_title_text = get_post_meta($post_id, 'pyre_page_title_text', true);
}
if (!$title) {
$title = get_the_title();
if (is_home()) {
$title = Avada()->settings->get('blog_title');
}
if (is_search()) {
$title = sprintf(__('Search results for: %s', 'Avada'), get_search_query());
}
if (is_404()) {
$title = __('Error 404 Page', 'Avada');
}
if (class_exists('Tribe__Events__Main') && (tribe_is_event() && !is_single() && !is_home() || is_events_archive() || is_events_archive() && is_404())) {
$title = tribe_get_events_title();
}
if (is_archive() && !is_bbpress() && !is_search()) {
if (is_day()) {
$title = sprintf(__('Daily Archives: %s', 'Avada'), '<span>' . get_the_date() . '</span>');
} else {
if (is_month()) {
$title = sprintf(__('Monthly Archives: %s', 'Avada'), '<span>' . get_the_date(_x('F Y', 'monthly archives date format', 'Avada')) . '</span>');
} elseif (is_year()) {
$title = sprintf(__('Yearly Archives: %s', 'Avada'), '<span> ' . get_the_date(_x('Y', 'yearly archives date format', 'Avada')) . '</span>');
} elseif (is_author()) {
$curauth = get_user_by('id', get_query_var('author'));
$title = $curauth->nickname;
} elseif (is_post_type_archive()) {
$title = post_type_archive_title('', false);
$sermon_settings = get_option('wpfc_options');
if (is_array($sermon_settings)) {
$title = $sermon_settings['archive_title'];
}
} else {
$title = single_cat_title('', false);
}
}
}
if (class_exists('WooCommerce') && is_woocommerce() && (is_product() || is_shop()) && !is_search()) {
if (!is_product()) {
$title = woocommerce_page_title(false);
}
}
}
if (!$subtitle && is_home()) {
$subtitle = Avada()->settings->get('blog_subtitle');
}
if (!is_archive() && !is_search() && !(is_home() && !is_front_page())) {
if ('no' == $page_title_text && ('yes' == get_post_meta($post_id, 'pyre_page_title', true) || 'yes_without_bar' == get_post_meta($post_id, 'pyre_page_title', true) || 'hide' != Avada()->settings->get('page_title_bar') && 'no' != get_post_meta($post_id, 'pyre_page_title', true))) {
$title = '';
$subtitle = '';
}
} else {
if ('hide' != Avada()->settings->get('page_title_bar') && 'no' == $page_title_text) {
$title = '';
$subtitle = '';
}
}
return array($title, $subtitle, $secondary_content);
}
示例10: tribe_events_template_data
/**
* Returns json for javascript templating functions throughout the plugin.
*
* @category Events
*
* @param $event
* @param $additional
*
* @return string
*/
function tribe_events_template_data($event = null, array $additional = null)
{
// Base JSON variable
$json = array('i18n' => array());
if (!is_null($event)) {
$event = get_post($event);
// Check if we are dealing with an Event
if (is_object($event) && $event instanceof WP_Post && tribe_is_event($event->ID)) {
$has_image = false;
$image_src = '';
$image_tool_src = '';
$date_display = '';
//Disable recurring event info in tooltip
if (class_exists('Tribe__Events__Pro__Main')) {
$ecp = Tribe__Events__Pro__Main::instance();
$ecp->disable_recurring_info_tooltip();
$date_display = strip_tags(tribe_events_event_schedule_details($event));
// Re-enable recurring event info
$ecp->enable_recurring_info_tooltip();
} else {
$date_display = strip_tags(tribe_events_event_schedule_details($event));
}
if (function_exists('has_post_thumbnail') && has_post_thumbnail($event->ID)) {
$has_image = true;
$image_arr = wp_get_attachment_image_src(get_post_thumbnail_id($event->ID), 'medium');
$image_src = $image_arr[0];
}
if ($has_image) {
$image_tool_arr = wp_get_attachment_image_src(get_post_thumbnail_id($event->ID), array(75, 75));
$image_tool_src = $image_tool_arr[0];
}
if (has_excerpt($event->ID)) {
$excerpt = $event->post_excerpt;
} else {
$excerpt = $event->post_content;
}
$excerpt = Tribe__Events__Main::instance()->truncate($excerpt, 30);
$category_classes = tribe_events_event_classes($event->ID, false);
$json['eventId'] = $event->ID;
$json['title'] = $event->post_title;
$json['permalink'] = tribe_get_event_link($event->ID);
$json['imageSrc'] = $image_src;
$json['dateDisplay'] = $date_display;
$json['imageTooltipSrc'] = $image_tool_src;
$json['excerpt'] = $excerpt;
$json['categoryClasses'] = $category_classes;
/**
* Template overrides (of month/tooltip.php) set up in 3.9.3 or earlier may still expect
* these vars and will break without them, so they are being kept temporarily for
* backwards compatibility purposes.
*
* @todo consider removing in 4.0
*/
$json['startTime'] = tribe_get_start_date($event);
$json['endTime'] = tribe_get_end_date($event);
}
}
/**
* Internationalization Strings
*/
$json['i18n']['find_out_more'] = esc_attr__('Find out more »', 'tribe-events-calendar');
$json['i18n']['for_date'] = esc_attr(sprintf(__('%s for', 'tribe-events-calendar'), tribe_get_event_label_plural()));
if ($additional) {
$json = array_merge((array) $json, (array) $additional);
}
$json = apply_filters('tribe_events_template_data_array', $json, $event, $additional);
$json = tribe_prepare_for_json_deep($json);
return json_encode($json);
}
示例11: mfn_breadcrumbs
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) {
//.........这里部分代码省略.........
示例12: tribe_add_start_time_to_event_title
/**
* Adds start time to event titles in Month view
*/
function tribe_add_start_time_to_event_title($post_title, $post_id)
{
if (!tribe_is_event($post_id)) {
return $post_title;
}
// Checks if it is the month view, modify this line to apply to more views
//if ( !tribe_is_month() ) return $post_title;
//---
if (tribe_is_past() || tribe_is_upcoming() && !is_tax()) {
$event_start_time = tribe_get_start_time($post_id);
if (!empty($event_start_time)) {
// $post_title = $post_title . ' | ' . $event_start_time;
}
return $post_title;
} else {
return $post_title;
}
}
示例13: dpd_2015_is_past_event
function dpd_2015_is_past_event($event_id)
{
if (!tribe_is_event($event_id)) {
return false;
}
$end_date = tribe_get_end_date($event_id, true, 'U');
return time() > $end_date;
}
示例14: array
<div class="col-md-4 col-sm-6 col-xs-12 dmbs-right">
<?php
//get the right sidebar
$blocks = array('firts_block', 'second_block');
dynamic_sidebar('Right Sidebar');
if (!(tribe_is_event(get_the_ID()) or get_the_ID() == 7)) {
?>
<div class="services center-block">
<h2>Services</h2>
<div class="service-description">Please select an individual for information</div>
<?php
print get_services();
?>
</div>
<div class="livestream">
<?php
if (function_exists('ot_get_option')) {
$watch_stream_link = ot_get_option('watch_stream_link');
print $watch_stream_link;
}
?>
</div>
<?php
} else {
$blocks = array_reverse($blocks);
}
?>
示例15: filter_tribe_events_pro_get_all_link
/**
* Filters the permalink generated for a recurring event "all" view to remove aberrations.
*
* @param string $event_url
* @param int $event_id
*
* @return string
*/
public function filter_tribe_events_pro_get_all_link($event_url, $event_id)
{
$post = get_post(Tribe__Main::post_id_helper($event_id));
if (!tribe_is_event($post) || $post->post_parent != 0) {
return $event_url;
}
$post_name = $post->post_name;
// WPML might replace the post name with `<post_name>/<date>`; we undo that here.
$event_url = preg_replace('~' . preg_quote($post_name) . '\\/\\d{4}-\\d{2}-\\d{2}~', $post_name, $event_url);
return $event_url;
}