/** * Formatted Date * * Returns formatted date * * @category Events * @param string $date String representing the datetime, assumed to be UTC (relevant if timezone conversion is used) * @param bool $display_time If true shows date and time, if false only shows date * @param string $date_format Allows date and time formating using standard php syntax (http://php.net/manual/en/function.date.php) * * @return string */ function tribe_format_date($date, $display_time = true, $date_format = '') { if (!Tribe__Date_Utils::is_timestamp($date)) { $date = strtotime($date); } if ($date_format) { $format = $date_format; } else { $date_year = date('Y', $date); $cur_year = date('Y', current_time('timestamp')); // only show the year in the date if it's not in the current year $with_year = $date_year == $cur_year ? false : true; if ($display_time) { $format = tribe_get_datetime_format($with_year); } else { $format = tribe_get_date_format($with_year); } } $date = date_i18n($format, $date); /** * Deprecated tribe_event_formatted_date in 4.0 in favor of tribe_formatted_date. Remove in 5.0 */ $date = apply_filters('tribe_event_formatted_date', $date, $display_time, $date_format); return apply_filters('tribe_formatted_date', $date, $display_time, $date_format); }
public function display_created_recurrences_notice() { $pending = get_post_meta(get_the_ID(), '_EventNextPendingRecurrence', true); if (!$pending) { return; } $start_dates = tribe_get_recurrence_start_dates(get_the_ID()); $count = count($start_dates); $last = end($start_dates); $pending_message = __('%d instances of this event have been created through %s. <a href="%s">Learn more.</a>', 'tribe-events-calendar-pro'); $pending_message = sprintf($pending_message, $count, date_i18n(tribe_get_date_format(true), strtotime($last)), 'http://m.tri.be/lq'); $this->notice->render($pending_message, 'updated'); }
/** * Injects event meta data into the Attendees report * * @param int $event_id */ public function event_details_top($event_id) { $post_type = get_post_type($event_id); if (Tribe__Events__Main::POSTTYPE === $post_type) { echo ' <li> <strong>' . esc_html__('Start Date:', 'the-events-calendar') . '</strong> ' . tribe_get_start_date($event_id, false, tribe_get_date_format(true)) . ' </li> '; } if (tribe_has_venue($event_id)) { $venue_id = tribe_get_venue_id($event_id); echo ' <li class="venue-name"> <strong>' . tribe_get_venue_label_singular() . ': </strong> <a href="' . get_edit_post_link($venue_id) . '" title="' . esc_html__('Edit Venue', 'the-events-calendar') . '">' . tribe_get_venue($event_id) . '</a> </li> '; } }
public function column_imported($post) { $record = Tribe__Events__Aggregator__Records::instance()->get_by_post_id($post); if ('scheduled' === $this->tab->get_slug()) { $has_child_record = $record->get_child_record_by_status('success', 1); if (!$has_child_record) { return $this->render(esc_html__('On Demand', 'the-events-calendar')); } } $last_import = null; $original = $post->post_modified_gmt; $time = strtotime($original); $now = current_time('timestamp', true); $html[] = '<span title="' . esc_attr($original) . '">'; if ($now - $time <= DAY_IN_SECONDS) { $diff = human_time_diff($time, $now); if ($now - $time > 0) { $html[] = sprintf(esc_html_x('about %s ago', 'human readable time ago', 'the-events-calendar'), $diff); } else { $html[] = sprintf(esc_html_x('in about %s', 'in human readable time', 'the-events-calendar'), $diff); } } else { $html[] = date(tribe_get_date_format(true), $time) . '<br>' . date(Tribe__Date_Utils::TIMEFORMAT, $time); } $html[] = '</span>'; return $this->render($html); }
/** * 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(esc_html__('Upcoming %s', 'the-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()) { $first_returned_date = tribe_get_start_date($wp_query->posts[0], false, Tribe__Date_Utils::DBDATEFORMAT); $first_event_date = tribe_get_start_date($wp_query->posts[0], false); $last_event_date = tribe_get_end_date($wp_query->posts[count($wp_query->posts) - 1], false); // If we are on page 1 then we may wish to use the *selected* start date in place of the // first returned event date if (1 == $wp_query->get('paged') && $_REQUEST['tribe-bar-date'] < $first_returned_date) { $first_event_date = tribe_format_date($_REQUEST['tribe-bar-date'], false); } $title = sprintf(__('%1$s for %2$s - %3$s', 'the-events-calendar'), $events_label_plural, $first_event_date, $last_event_date); } elseif (tribe_is_past()) { $title = sprintf(esc_html__('Past %s', 'the-events-calendar'), $events_label_plural); } if (tribe_is_month()) { $title = sprintf(esc_html__('%1$s for %2$s', 'the-events-calendar'), $events_label_plural, date_i18n(tribe_get_date_option('monthAndYearFormat', 'F Y'), strtotime(tribe_get_month_view_date()))); } // day view title if (tribe_is_day()) { $title = sprintf(esc_html__('%1$s for %2$s', 'the-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); }
protected function nothing_found_notice() { list($search_term, $tax_term, $geographic_term) = $this->get_search_terms(); if (empty($search_term) && empty($geographic_term) && !empty($tax_term)) { TribeEvents::setNotice('events-not-found', sprintf(__('No matching events listed under %s scheduled for <strong>%s</strong>. Please try another day.', 'tribe-events-calendar'), $tax_term, date_i18n(tribe_get_date_format(true), strtotime(get_query_var('eventDate'))))); } elseif (empty($search_term) && empty($geographic_term)) { TribeEvents::setNotice('events-not-found', sprintf(__('No events scheduled for <strong>%s</strong>. Please try another day.', 'tribe-events-calendar'), date_i18n(tribe_get_date_format(true), strtotime(get_query_var('eventDate'))))); } else { parent::nothing_found_notice(); } }
/** * Return the details of the start/end date/time. * * The highest level means of customizing this function's output is simply to adjust the date format settings under * Events > Settings > Display, and WordPress time formats (via the General Settings admin screen). * Beyond that, however, there are two filters which can be used to exercise further control here. * * The first is 'tribe_events_event_schedule_details_formatting' which allows an array of format settings to be * altered - it's basic make-up is as a simple set of key:value pairs as follows. * * "show_end_time": for single day events only (not including all day events) it may not always be desirable to * include the end time. In that situation, this setting can be set to false and the end time will not be * displayed. * * "time": if it is undesirable to show times and only dates should be displayed then this setting can be set to * false. If it is false it will by extension cause 'show_end_time' to be false. * * The resulting string can also be caught and manipulated, or completely overridden, using the * 'tribe_events_event_schedule_details' filter, should none of the above settings be sufficient. * * @category Events * @TODO use tribe_get_datetime_format() and related functions if possible * * @param int|null $event * @param string $before * @param string $after * * @return mixed|void */ function tribe_events_event_schedule_details($event = null, $before = '', $after = '') { if (is_null($event)) { global $post; $event = $post; } if (is_numeric($event)) { $event = get_post($event); } $schedule = '<span class="date-start dtstart">'; $format = ''; $date_without_year_format = tribe_get_date_format(); $date_with_year_format = tribe_get_date_format(true); $time_format = get_option('time_format'); $datetime_separator = tribe_get_option('dateTimeSeparator', ' @ '); $time_range_separator = tribe_get_option('timeRangeSeparator', ' - '); $microformatStartFormat = tribe_get_start_date($event, false, 'Y-m-dTh:i'); $microformatEndFormat = tribe_get_end_date($event, false, 'Y-m-dTh:i'); $settings = array('show_end_time' => true, 'time' => true); $settings = wp_parse_args(apply_filters('tribe_events_event_schedule_details_formatting', $settings), $settings); if (!$settings['time']) { $settings['show_end_time'] = false; } extract($settings); $format = $date_with_year_format; // if it starts and ends in the current year then there is no need to display the year if (tribe_get_start_date($event, false, 'Y') === date('Y') && tribe_get_end_date($event, false, 'Y') === date('Y')) { $format = $date_without_year_format; } if (tribe_event_is_multiday($event)) { // multi-date event $format2ndday = apply_filters('tribe_format_second_date_in_range', $format, $event); if (tribe_event_is_all_day($event)) { $schedule .= tribe_get_start_date($event, true, $format); $schedule .= '<span class="value-title" title="' . $microformatStartFormat . '"></span>'; $schedule .= '</span>' . $time_range_separator; $schedule .= '<span class="date-end dtend">'; $schedule .= tribe_get_end_date($event, true, $format2ndday); $schedule .= '<span class="value-title" title="' . $microformatEndFormat . '"></span>'; } else { $schedule .= tribe_get_start_date($event, false, $format) . ($time ? $datetime_separator . tribe_get_start_date($event, false, $time_format) : ''); $schedule .= '<span class="value-title" title="' . $microformatStartFormat . '"></span>'; $schedule .= '</span>' . $time_range_separator; $schedule .= '<span class="date-end dtend">'; $schedule .= tribe_get_end_date($event, false, $format2ndday) . ($time ? $datetime_separator . tribe_get_end_date($event, false, $time_format) : ''); $schedule .= '<span class="value-title" title="' . $microformatEndFormat . '"></span>'; } } elseif (tribe_event_is_all_day($event)) { // all day event $schedule .= tribe_get_start_date($event, true, $format); $schedule .= '<span class="value-title" title="' . $microformatStartFormat . '"></span>'; } else { // single day event if (tribe_get_start_date($event, false, 'g:i A') === tribe_get_end_date($event, false, 'g:i A')) { // Same start/end time $schedule .= tribe_get_start_date($event, false, $format) . ($time ? $datetime_separator . tribe_get_start_date($event, false, $time_format) : ''); $schedule .= '<span class="value-title" title="' . $microformatStartFormat . '"></span>'; } else { // defined start/end time $schedule .= tribe_get_start_date($event, false, $format) . ($time ? $datetime_separator . tribe_get_start_date($event, false, $time_format) : ''); $schedule .= '<span class="value-title" title="' . $microformatStartFormat . '"></span>'; $schedule .= '</span>' . ($show_end_time ? $time_range_separator : ''); $schedule .= '<span class="end-time dtend">'; $schedule .= ($show_end_time ? tribe_get_end_date($event, false, $time_format) : '') . '<span class="value-title" title="' . $microformatEndFormat . '"></span>'; } } $schedule .= '</span>'; $schedule = $before . $schedule . $after; return apply_filters('tribe_events_event_schedule_details', $schedule, $event->ID); }
/** * Returns json for javascript templating functions throughout the plugin. * * @param $event * @param $additional * * @return string */ function tribe_events_template_data($event, array $additional = null) { $has_image = false; $start_time = ''; $end_time = ''; $image_src = ''; $image_tool_src = ''; // @TODO use tribe_events_event_schedule_details() $date_format = tribe_get_date_format(true); $time_format = get_option('time_format', TribeDateUtils::TIMEFORMAT); $date_time_separator = tribe_get_option('dateTimeSeparator', ' @ '); if (!empty($event->EventStartDate)) { $start_time .= date_i18n($date_format, strtotime($event->EventStartDate)); } if (!tribe_get_event_meta($event->ID, '_EventAllDay', true)) { $start_time .= $date_time_separator . date_i18n($time_format, strtotime($event->EventStartDate)); } if (!empty($event->EventEndDate) && $event->EventStartDate !== $event->EventEndDate) { if (date('Y-m-d', strtotime($event->EventStartDate)) == date('Y-m-d', strtotime($event->EventEndDate))) { if (!tribe_get_event_meta($event->ID, '_EventAllDay', true)) { $end_time .= date_i18n($time_format, strtotime($event->EventEndDate)); } } else { $end_time .= date_i18n($date_format, strtotime($event->EventEndDate)); if (!tribe_get_event_meta($event->ID, '_EventAllDay', true)) { $end_time .= $date_time_separator . date_i18n($time_format, strtotime($event->EventEndDate)); } } } 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 = TribeEvents::instance()->truncate($excerpt, 30); $category_classes = tribe_events_event_classes($event->ID, false); $json = array('eventId' => $event->ID, 'title' => $event->post_title, 'permalink' => tribe_get_event_link($event->ID), 'imageSrc' => $image_src, 'startTime' => $start_time, 'endTime' => $end_time, 'imageTooltipSrc' => $image_tool_src, 'excerpt' => $excerpt, 'categoryClasses' => $category_classes); 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); }
/** * Get the Datetime Format * * @category Events * * @param bool $with_year * * @return mixed|void */ function tribe_get_datetime_format($with_year = false) { $separator = (array) str_split(tribe_get_option('dateTimeSeparator', ' @ ')); $format = tribe_get_date_format($with_year); $format .= (!empty($separator) ? '\\' : '') . implode('\\', $separator); $format .= get_option('time_format'); return apply_filters('tribe_datetime_format', $format); }
/** * 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); }
/** * Add event title where appropriate * * @param string $title * @param string|null $sep * @return mixed|void */ public function maybeAddEventTitle($title, $sep = null) { switch (get_query_var('eventDisplay')) { case 'upcoming': $new_title = apply_filters('tribe_upcoming_events_title', __("Upcoming Events", 'tribe-events-calendar') . ' ' . $sep . ' ' . $title, $sep); break; case 'past': $new_title = apply_filters('tribe_past_events_title', __("Past Events", 'tribe-events-calendar') . ' ' . $sep . ' ' . $title, $sep); break; case 'month': if (get_query_var('eventDate')) { $title_date = date_i18n(tribe_get_option('monthAndYearFormat', 'F Y'), strtotime(get_query_var('eventDate'))); $new_title = apply_filters('tribe_month_grid_view_title', sprintf(__("Events for %s", 'tribe-events-calendar'), $title_date) . ' ' . $sep . ' ' . $title, $sep, $title_date); } else { $new_title = apply_filters('tribe_events_this_month_title', sprintf(__("Events this month", 'tribe-events-calendar'), get_query_var('eventDate')) . ' ' . $sep . ' ' . $title, $sep); } break; case 'day': $title_date = date_i18n(tribe_get_date_format(true), strtotime(get_query_var('eventDate'))); $new_title = apply_filters('tribe_events_day_view_title', sprintf(__("Events for %s", 'tribe-events-calendar'), $title_date) . ' ' . $sep . ' ', $sep, $title_date); break; default: $new_title = $title; break; } return apply_filters('tribe_events_add_title', $new_title, $title, $sep); }
function getBlogTitle() { global $wp_query; $page = getBlogType(); if (themerex_strpos($page, 'woocommerce') !== false) { if ($page == 'woocommerce_category') { $cat = get_term_by('slug', get_query_var('product_cat'), 'product_cat', ARRAY_A); return $cat['name']; } else { if ($page == 'woocommerce_tag') { return sprintf(__('Tag: %s', 'themerex'), single_tag_title('', false)); } else { if ($page == 'woocommerce_cart') { return __('Your cart', 'themerex'); } else { if ($page == 'woocommerce_checkout') { return __('Checkout', 'themerex'); } else { if ($page == 'woocommerce_account') { return __('Account', 'themerex'); } else { if ($page == 'woocommerce_product') { return getPostTitle(); } else { if (($page_id = get_option('woocommerce_shop_page_id')) > 0) { return getPostTitle($page_id); } //__( 'Shop', 'themerex' ); } } } } } } } else { if (themerex_strpos($page, 'tribe') !== false) { //return tribe_get_events_title(); if ($page == 'tribe_category') { $cat = get_term_by('slug', get_query_var('tribe_events_cat'), 'tribe_events_cat', ARRAY_A); return $cat['name']; } else { if ($page == 'tribe_tag') { return sprintf(__('Tag: %s', 'themerex'), single_tag_title('', false)); } else { if ($page == 'tribe_venue') { return sprintf(__('Venue: %s', 'themerex'), tribe_get_venue()); } else { if ($page == 'tribe_organizer') { return sprintf(__('Organizer: %s', 'themerex'), tribe_get_organizer()); } else { if ($page == 'tribe_day') { return sprintf(__('Daily Events: %s', 'themerex'), date_i18n(tribe_get_date_format(true), strtotime($wp_query->get('start_date')))); } else { if ($page == 'tribe_month') { return sprintf(__('Monthly Events: %s', 'themerex'), date_i18n(tribe_get_option('monthAndYearFormat', 'F Y'), strtotime(tribe_get_month_view_date()))); } else { if ($page == 'tribe_event') { return getPostTitle(); } else { return __('Tribe Events', 'themerex'); } } } } } } } } else { if ($page == 'blog') { return __('All Posts', 'themerex'); } else { if ($page == 'author') { $curauth = get_query_var('author_name') ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); return sprintf(__('Author page: %s', 'themerex'), $curauth->display_name); } else { if ($page == 'error') { return __('URL not found', 'themerex'); } else { if ($page == 'search') { return sprintf(__('Search Results for: %s', 'themerex'), get_search_query()); } else { if ($page == 'archives_day') { return sprintf(__('Daily Archives: %s', 'themerex'), prepareDateForTranslation(get_the_date())); } else { if ($page == 'archives_month') { return sprintf(__('Monthly Archives: %s', 'themerex'), prepareDateForTranslation(get_the_date('F Y'))); } else { if ($page == 'archives_year') { return sprintf(__('Yearly Archives: %s', 'themerex'), get_the_date('Y')); } else { if ($page == 'category') { return sprintf(__('%s', 'themerex'), single_cat_title('', false)); } else { if ($page == 'tag') { return sprintf(__('Tag: %s', 'themerex'), single_tag_title('', false)); } else { if ($page == 'attachment') { return sprintf(__('Attachment: %s', 'themerex'), getPostTitle()); } else { if ($page == 'single') { return getPostTitle(); } else { if ($page == 'page') { return getPostTitle(); } else { return get_bloginfo('name', 'raw'); } } } } } } } } } } } } } } // Unknown pages - as homepage }
/** * Event Title * * Return an event's title with pseudo-breadcrumb if on a category * * @param bool $depth include linked title * @return string title */ function tribe_get_events_title($depth = true) { global $wp_query; $tribe_ecp = TribeEvents::instance(); $title = __('Upcoming Events', 'tribe-events-calendar'); // TODO: Use the displayed dates for the title if (tribe_is_past()) { $title = __('Past Events', 'tribe-events-calendar'); } if (tribe_is_month()) { $title = sprintf(__('Events for %s', 'tribe-events-calendar'), date_i18n(tribe_get_option('monthAndYearFormat', 'F Y'), strtotime(tribe_get_month_view_date()))); } // day view title if (tribe_is_day()) { $title = __('Events for', 'tribe-events-calendar') . ' ' . date_i18n(tribe_get_date_format(true), strtotime($wp_query->get('start_date'))); } if (is_tax($tribe_ecp->get_event_taxonomy())) { $cat = get_queried_object(); if ($depth) { $title = '<a href="' . tribe_get_events_link() . '">' . $title . '</a>'; $title .= ' › ' . $cat->name; } else { $title = $cat->name; } } return apply_filters('tribe_template_factory_debug', apply_filters('tribe_get_events_title', $title), 'tribe_get_events_title'); }
/** * Event Title * * Return an event's title with pseudo-breadcrumb if on a category * * @param bool $depth include linked title * @return string title * @since 2.0 */ function tribe_get_events_title($depth = true) { global $wp_query; $tribe_ecp = TribeEvents::instance(); $title = __('Upcoming Events', 'tribe-events-calendar'); // TODO: Use the displayed dates for the title /* if ( tribe_is_upcoming() || isset( $_REQUEST['tribe-bar-date'] ) ) { $start_date = date( 'Y-m-d', strtotime( $wp_query->get( 'start_date' ) ) ); if ( $wp_query->get( 'start_date' ) && $start_date != date('Y-m-d') ) { if ( get_query_var('paged') > 1 ) { // get the date of the first post $first_post = reset($wp_query->posts); $start_date = date('Y-m-d', strtotime($first_post->EventStartDate)); } $format = __('Events for %1$s', 'tribe-events-calendar'); $args = array(date_i18n( get_option( 'date_format', 'Y-m-d' ), strtotime($start_date) )); // Get the date of the last post if ( count($wp_query->posts) > 1 ) { $last_post = end($wp_query->posts); $last_post_date = date('Y-m-d', strtotime($last_post->EventStartDate)); if ( $last_post_date != $start_date ) { $format = __('Events for %1$s through %2$s', 'tribe-events-calendar'); $args[] = date_i18n( get_option( 'date_format', 'Y-m-d' ), strtotime($last_post_date) ); } } $title = vsprintf($format, $args); } } else */ if (tribe_is_past()) { $title = __('Past Events', 'tribe-events-calendar'); } if (tribe_is_month()) { $title = sprintf(__('Events for %s', 'tribe-events-calendar'), date_i18n(tribe_get_option('monthAndYearFormat', 'F Y'), strtotime(tribe_get_month_view_date()))); } // day view title if (tribe_is_day()) { $title = __('Events for', 'tribe-events-calendar') . ' ' . date_i18n(tribe_get_date_format(true), strtotime($wp_query->get('start_date'))); } if (is_tax($tribe_ecp->get_event_taxonomy())) { $cat = get_queried_object(); if ($depth) { $title = '<a href="' . tribe_get_events_link() . '">' . $title . '</a>'; $title .= ' › ' . $cat->name; } else { $title = $cat->name; } } return apply_filters('tribe_template_factory_debug', apply_filters('tribe_get_events_title', $title), 'tribe_get_events_title'); }
public static function display_post_editor_recurring_notice() { $message = __('You are currently editing all events in a recurring series.', 'tribe-events-calendar-pro'); printf('<div class="updated"><p>%s</p></div>', $message); $pending = get_post_meta(get_the_ID(), '_EventNextPendingRecurrence', true); if ($pending) { $start_dates = tribe_get_recurrence_start_dates(get_the_ID()); $count = count($start_dates); $last = end($start_dates); $pending_message = __('%d instances of this event have been created through %s. <a href="%s">Learn more.</a>', 'tribe-events-calendar-pro'); $pending_message = sprintf($pending_message, $count, date_i18n(tribe_get_date_format(true), strtotime($last)), 'http://m.tri.be/lq'); printf('<div class="updated"><p>%s</p></div>', $pending_message); } }
/** * Sets the page title for the various PRO views. * * @param string $content The current title. * @return string The modified title. * @author Jessica Yazbek * @since 3.0 */ function reset_page_title($content) { global $wp_query; $tec = TribeEvents::instance(); $date_format = apply_filters('tribe_events_pro_page_title_date_format', tribe_get_date_format(true)); if (tribe_is_showing_all()) { $reset_title = sprintf('%s %s', __('All events for', 'tribe-events-calendar-pro'), get_the_title()); } // week view title if (tribe_is_week()) { $reset_title = sprintf(__('Events for week of %s', 'tribe-events-calendar-pro'), date_i18n($date_format, strtotime(tribe_get_first_week_day($wp_query->get('start_date'))))); } // map or photo view titles if (tribe_is_map() || tribe_is_photo()) { if (tribe_is_past()) { $reset_title = __('Past Events', 'tribe-events-calendar-pro'); } else { $reset_title = __('Upcoming Events', 'tribe-events-calendar-pro'); } } return isset($reset_title) ? apply_filters('tribe_template_factory_debug', $reset_title, 'tribe_get_events_title') : $content; }
function axiom_tribe_events_get_blog_title($title, $page) { if (!empty($title)) { return $title; } if (axiom_strpos($page, 'tribe') !== false) { //return tribe_get_events_title(); if ($page == 'tribe_category') { $cat = get_term_by('slug', get_query_var('tribe_events_cat'), 'tribe_events_cat', ARRAY_A); $title = $cat['name']; } else { if ($page == 'tribe_tag') { $title = sprintf(__('Tag: %s', 'axiom'), single_tag_title('', false)); } else { if ($page == 'tribe_venue') { $title = sprintf(__('Venue: %s', 'axiom'), tribe_get_venue()); } else { if ($page == 'tribe_organizer') { $title = sprintf(__('Organizer: %s', 'axiom'), tribe_get_organizer()); } else { if ($page == 'tribe_day') { $title = sprintf(__('Daily Events: %s', 'axiom'), date_i18n(tribe_get_date_format(true), strtotime(get_query_var('start_date')))); } else { if ($page == 'tribe_month') { $title = sprintf(__('Monthly Events: %s', 'axiom'), date_i18n(tribe_get_option('monthAndYearFormat', 'F Y'), strtotime(tribe_get_month_view_date()))); } else { if ($page == 'tribe_event') { $title = axiom_get_post_title(); } else { $title = __('Tribe Events', 'axiom'); } } } } } } } } return $title; }
protected function nothing_found_notice() { $events_label_plural_lowercase = tribe_get_event_label_plural_lowercase(); list($search_term, $tax_term, $geographic_term) = $this->get_search_terms(); if (empty($search_term) && empty($geographic_term) && !empty($tax_term)) { Tribe__Notices::set_notice('events-not-found', sprintf(esc_html__('No matching %1$s listed under %2$s scheduled for %3$s. Please try another day.', 'the-events-calendar'), $events_label_plural_lowercase, $tax_term, '<strong>' . date_i18n(tribe_get_date_format(true), strtotime(get_query_var('eventDate'))) . '</strong>')); } elseif (empty($search_term) && empty($geographic_term)) { Tribe__Notices::set_notice('events-not-found', sprintf(esc_html__('No %1$s scheduled for %2$s. Please try another day.', 'the-events-calendar'), $events_label_plural_lowercase, '<strong>' . date_i18n(tribe_get_date_format(true), strtotime(get_query_var('eventDate'))) . '</strong>')); } else { parent::nothing_found_notice(); } }
/** * Formatted Date * * Returns formatted date * * @param string $date * @param bool $displayTime If true shows date and time, if false only shows date * @param string $dateFormat Allows date and time formating using standard php syntax (http://php.net/manual/en/function.date.php) * * @return string */ function tribe_event_format_date($date, $displayTime = true, $dateFormat = '') { if (!TribeDateUtils::isTimestamp($date)) { $date = strtotime($date); } if ($dateFormat) { $format = $dateFormat; } else { $date_year = date('Y', $date); $cur_year = date('Y', current_time('timestamp')); // only show the year in the date if it's not in the current year $with_year = $date_year == $cur_year ? false : true; if ($displayTime) { $format = tribe_get_datetime_format($with_year); } else { $format = tribe_get_date_format($with_year); } } $date = date_i18n($format, $date); return apply_filters('tribe_event_formatted_date', $date, $displayTime, $dateFormat); }
/** * Set up the notices for this template * * @return void **/ public function set_notices() { global $wp_query; $tribe = TribeEvents::instance(); $geographic_term = ''; $search_term = ''; $tax_term = ''; // No need to set notices unless we didn't find anything if (have_posts()) { return; } // Do we have a keyword or place name search? if (!empty($wp_query->query_vars['s'])) { $search_term = $wp_query->query_vars['s']; } elseif (!empty($_REQUEST['tribe-bar-search'])) { $search_term = $_REQUEST['tribe-bar-search']; } elseif (!empty($_REQUEST['tribe-bar-geoloc'])) { $geographic_term = $_REQUEST['tribe-bar-geoloc']; } if (is_tax($tribe->get_event_taxonomy())) { $tax_term = get_term_by('slug', get_query_var('term'), $tribe->get_event_taxonomy()); $tax_term = $tax_term->name; } // No events found on this day if (empty($search_term) && empty($geographic_term) && !empty($tax_term)) { TribeEvents::setNotice('events-not-found', sprintf(__('No matching events listed under %s scheduled for <strong>%s</strong>. Please try another day.', 'tribe-events-calendar'), $tax_term, date_i18n(tribe_get_date_format(true), strtotime(get_query_var('eventDate'))))); } elseif (empty($search_term) && empty($geographic_term)) { TribeEvents::setNotice('events-not-found', sprintf(__('No events scheduled for <strong>%s</strong>. Please try another day.', 'tribe-events-calendar'), date_i18n(tribe_get_date_format(true), strtotime(get_query_var('eventDate'))))); } else { parent::set_notices(); } }
/** * Sets the page title for the various PRO views. * * @param string $title The current title. * * @return string The modified title. */ function reset_page_title($title, $depth = true) { global $wp_query; $tec = TribeEvents::instance(); $date_format = apply_filters('tribe_events_pro_page_title_date_format', tribe_get_date_format(true)); if (tribe_is_showing_all()) { $reset_title = sprintf('%s %s', __('All events for', 'tribe-events-calendar-pro'), get_the_title()); } // week view title if (tribe_is_week()) { $reset_title = sprintf(__('Events for week of %s', 'tribe-events-calendar-pro'), date_i18n($date_format, strtotime(tribe_get_first_week_day($wp_query->get('start_date'))))); } if (!empty($reset_title) && is_tax($tec->get_event_taxonomy()) && $depth) { $cat = get_queried_object(); $reset_title = '<a href="' . tribe_get_events_link() . '">' . $reset_title . '</a>'; $reset_title .= ' › ' . $cat->name; } return isset($reset_title) ? apply_filters('tribe_template_factory_debug', $reset_title, 'tribe_get_events_title') : $title; }
/** * Return the details of the start/end date/time. * * The highest level means of customizing this function's output is simply to adjust the date format settings under * Events > Settings > Display, and WordPress time formats (via the General Settings admin screen). * Beyond that, however, there are two filters which can be used to exercise further control here. * * The first is 'tribe_events_event_schedule_details_formatting' which allows an array of format settings to be * altered - it's basic make-up is as a simple set of key:value pairs as follows. * * "show_end_time": for single day events only (not including all day events) it may not always be desirable to * include the end time. In that situation, this setting can be set to false and the end time will not be * displayed. * * "time": if it is undesirable to show times and only dates should be displayed then this setting can be set to * false. If it is false it will by extension cause 'show_end_time' to be false. * * The resulting string can also be caught and manipulated, or completely overridden, using the * 'tribe_events_event_schedule_details' filter, should none of the above settings be sufficient. * * @category Events * @TODO use tribe_get_datetime_format() and related functions if possible * * @param int|null $event * @param string $before * @param string $after * * @return mixed|void */ function tribe_events_event_schedule_details($event = null, $before = '', $after = '') { if (is_null($event)) { global $post; $event = $post; } if (is_numeric($event)) { $event = get_post($event); } $inner = '<span class="tribe-event-date-start">'; $format = ''; $date_without_year_format = tribe_get_date_format(); $date_with_year_format = tribe_get_date_format(true); $time_format = get_option('time_format'); $datetime_separator = tribe_get_option('dateTimeSeparator', ' @ '); $time_range_separator = tribe_get_option('timeRangeSeparator', ' - '); $settings = array('show_end_time' => true, 'time' => true); $settings = wp_parse_args(apply_filters('tribe_events_event_schedule_details_formatting', $settings), $settings); if (!$settings['time']) { $settings['show_end_time'] = false; } /** * @var $show_end_time * @var $time */ extract($settings); $format = $date_with_year_format; // if it starts and ends in the current year then there is no need to display the year if (tribe_get_start_date($event, false, 'Y') === date('Y') && tribe_get_end_date($event, false, 'Y') === date('Y')) { $format = $date_without_year_format; } if (tribe_event_is_multiday($event)) { // multi-date event $format2ndday = apply_filters('tribe_format_second_date_in_range', $format, $event); if (tribe_event_is_all_day($event)) { $inner .= tribe_get_start_date($event, true, $format); $inner .= '</span>' . $time_range_separator; $inner .= '<span class="tribe-event-date-end">'; $inner .= tribe_get_end_date($event, true, $format2ndday); } else { $inner .= tribe_get_start_date($event, false, $format) . ($time ? $datetime_separator . tribe_get_start_date($event, false, $time_format) : ''); $inner .= '</span>' . $time_range_separator; $inner .= '<span class="tribe-event-date-end">'; $inner .= tribe_get_end_date($event, false, $format2ndday) . ($time ? $datetime_separator . tribe_get_end_date($event, false, $time_format) : ''); } } elseif (tribe_event_is_all_day($event)) { // all day event $inner .= tribe_get_start_date($event, true, $format); } else { // single day event if (tribe_get_start_date($event, false, 'g:i A') === tribe_get_end_date($event, false, 'g:i A')) { // Same start/end time $inner .= tribe_get_start_date($event, false, $format) . ($time ? $datetime_separator . tribe_get_start_date($event, false, $time_format) : ''); } else { // defined start/end time $inner .= tribe_get_start_date($event, false, $format) . ($time ? $datetime_separator . tribe_get_start_date($event, false, $time_format) : ''); $inner .= '</span>' . ($show_end_time ? $time_range_separator : ''); $inner .= '<span class="tribe-event-time">'; $inner .= $show_end_time ? tribe_get_end_date($event, false, $time_format) : ''; } } $inner .= '</span>'; /** * Provides an opportunity to modify the *inner* schedule details HTML (ie before it is * wrapped). * * @param string $inner_html the output HTML * @param int $event_id post ID of the event we are interested in */ $inner = apply_filters('tribe_events_event_schedule_details_inner', $inner, $event->ID); // Wrap the schedule text $schedule = $before . $inner . $after; /** * Provides an opportunity to modify the schedule details HTML for a specific event after * it has been wrapped in the before and after markup. * * @param string $schedule the output HTML * @param int $event_id post ID of the event we are interested in * @param string $before part of the HTML wrapper that was prepended * @param string $after part of the HTML wrapper that was appended */ return apply_filters('tribe_events_event_schedule_details', $schedule, $event->ID, $before, $after); }
/** * This Week - Title * * @param string $this_week_title * * @return string */ function tribe_events_get_this_week_title($start_date) { $events_label_plural = tribe_get_event_label_plural(); $date_format = apply_filters('tribe_events_pro_page_title_date_format', tribe_get_date_format(true)); $this_week_title = sprintf(__('%s for week of %s', 'tribe-events-calendar-pro'), $events_label_plural, date_i18n($date_format, strtotime($start_date))); return $this_week_title; }
/** * Convert the event recurrence meta into a human readable string * * @TODO: there's a great deal of duplication between this method and tribe_events_pro_admin.recurrence.update_rule_recurrence_text (events-recurrence.js) * let's consider generating once (by JS?) and saving the result for re-use instead * * @param array $rule * @param string $start_date * @param int $event_id * * @return string human readable string */ public static function recurrenceToText($rule, $start_date, $event_id) { $text = ''; $recurrence_strings = Tribe__Events__Pro__Recurrence__Strings::recurrence_strings(); $date_strings = self::date_strings(); $interval = 1; $is_custom = false; $same_time = true; $year_filtered = false; $rule['type'] = str_replace(' ', '-', strtolower($rule['type'])); $rule['end-type'] = str_replace(' ', '-', strtolower($rule['end-type'])); $formatted_end = _x('an unspecified date', 'An unspecified end date', 'tribe-events-calendar-pro'); if (!empty($rule['end'])) { $formatted_end = date(tribe_get_date_format(true), strtotime($rule['end'])); } // if the type is "none", then there's no rules to parse if ('none' === $rule['type']) { return; } // if there isn't an end date, then there isn't a recurrence set up if ('on' === $rule['end-type'] && empty($rule['end'])) { return; } if ('custom' === $rule['type']) { $is_custom = true; $same_time = false; if ('yes' === @$rule['custom'][Tribe__Events__Pro__Recurrence__Custom_Types::to_key($rule['custom']['type'])]['same-time']) { $same_time = true; } if ('Yearly' === $rule['custom']['type']) { $year_filtered = !empty($rule['custom']['year']['filter']); } } $start_date = strtotime(tribe_get_start_date($event_id, true, Tribe__Date_Utils::DBDATETIMEFORMAT)); $end_date = strtotime(tribe_get_end_date($event_id, true, Tribe__Date_Utils::DBDATETIMEFORMAT)); $num_days = floor(($end_date - $start_date) / DAY_IN_SECONDS); // make sure we always round hours UP to when dealing with decimal lengths more than 2. Example: 4.333333 would become 4.34 $num_hours = ceil((($end_date - $start_date) / HOUR_IN_SECONDS - $num_days * 24) * 100) / 100; if ($is_custom && 'custom' === $rule['type'] && !$same_time) { $formatted_start = date('Y-m-d', $start_date) . ' ' . $rule['custom']['start-time']['hour'] . ':' . $rule['custom']['start-time']['minute']; if (isset($rule['custom']['start-time']['meridian'])) { $formatted_start .= ' ' . $rule['custom']['start-time']['meridian']; } if (isset($rule['custom']['duration'])) { try { $end_date = new DateTime('@' . $start_date); $end_date->modify('+' . absint($rule['custom']['duration']['days']) . ' days'); $end_date->modify('+' . absint($rule['custom']['duration']['hours']) . ' hours'); $end_date->modify('+' . absint($rule['custom']['duration']['minutes']) . ' minutes'); $formatted_end = Tribe__View_Helpers::is_24hr_format() ? $end_date->format('Y-m-d H:i') : $end_date->format('Y-m-d g:i'); $end_date = $end_date->format('U'); } catch (Exception $e) { // $formatted_end will default to the "unspecified end date" text in this case } } $new_num_days = floor(($end_date - $start_date) / DAY_IN_SECONDS); // make sure we always round hours UP to when dealing with decimal lengths more than 2. Example: 4.333333 would become 4.34 $new_num_hours = ceil((($end_date - $start_date) / HOUR_IN_SECONDS - $new_num_days * 24) * 100) / 100; } $weekdays = array(); $months = array(); $month_number = null; $month_day = null; $month_day_description = null; if ($is_custom && 'Weekly' === $rule['custom']['type'] && !empty($rule['custom']['week']['day'])) { foreach ($rule['custom']['week']['day'] as $day) { $weekdays[] = $date_strings['weekdays'][$day - 1]; } if (!$weekdays) { $weekdays = $date_strings['day_placeholder']; } elseif (2 === count($weekdays)) { $weekdays = implode(" {$date_strings['collection_joiner']} ", $weekdays); } else { $weekdays = implode(', ', $weekdays); $weekdays = preg_replace('/(.*),/', '$1, ' . $date_strings['collection_joiner'], $weekdays); } } elseif ($is_custom && 'Monthly' === $rule['custom']['type'] && !empty($rule['custom']['month']['number']) && !empty($rule['custom']['month']['day'])) { $month_number = $rule['custom']['month']['number']; $month_day = $rule['custom']['month']['day']; } elseif ($is_custom && 'Yearly' === $rule['custom']['type'] && !empty($rule['custom']['year']['month-number']) && !empty($rule['custom']['year']['month-day'])) { $month_number = $rule['custom']['year']['month-number']; $month_day = $rule['custom']['year']['month-day']; if (!empty($rule['custom']['year']['month'])) { foreach ($rule['custom']['year']['month'] as $month) { $months[] = $date_strings['months'][$month - 1]; } } if (!$months) { $months = $date_strings['month_placeholder']; } elseif (2 === count($months)) { $months = implode(" {$date_strings['collection_joiner']} ", $months); } else { $months = implode(', ', $months); $months = preg_replace('/(.*),/', '$1, ' . $date_strings['collection_joiner'], $months); } } $key = $rule['type']; if ('custom' === $rule['type']) { $key .= "-{$rule['custom']['type']}-{$rule['end-type']}-" . ($same_time ? 'same' : 'diff') . '-time'; if ('monthly' === $rule['custom']['type'] && is_numeric($month_number)) { $key .= '-numeric'; } elseif ('yearly' === $rule['custom']['type'] && !$year_filtered) { $key .= '-unfiltered'; } } else { $key = "simple-{$key}"; $key .= "-{$rule['end-type']}"; } $key = strtolower($key); // if custom rules were set but the custom-specific data is missing, then revert to standard // rules (weekly, monthly, and yearly) if ($is_custom && 'Weekly' === $rule['custom']['type'] && !$weekdays) { $key = 'every-week-on'; } elseif ($is_custom && 'Monthly' === $rule['custom']['type'] && !$month_number && !$month_day) { $key = 'every-month-on'; } elseif ($is_custom && 'Yearly' === $rule['custom']['type'] && !$month_number && !$month_day) { $key = 'every-year-on'; } $text = $recurrence_strings[$key]; switch ($key) { case 'simple-every-day-on': case 'simple-every-week-on': case 'simple-every-month-on': case 'simple-every-year-on': $text = sprintf($text, $formatted_end); break; case 'every-day-on': case 'every-week-on': case 'every-month-on': case 'every-year-on': case 'every-day-never': case 'every-week-never': case 'every-month-never': case 'every-year-never': $text = sprintf($text, $num_days, $num_hours, $formatted_end); break; case 'every-day-after': case 'every-week-after': case 'every-month-after': case 'every-year-after': $text = sprintf($text, $num_days, $num_hours, $rule['end-count']); break; case 'custom-daily-on-same-time': case 'custom-daily-never-same-time': $text = sprintf($text, $interval, $num_days, $num_hours, $formatted_end); break; case 'custom-daily-after-same-time': $text = sprintf($text, $interval, $num_days, $num_hours, $rule['end-count']); break; case 'custom-daily-on-diff-time': case 'custom-daily-never-diff-time': $text = sprintf($text, $interval, $formatted_start, $new_num_days, $new_num_hours, $formatted_end); break; case 'custom-daily-after-diff-time': $text = sprintf($text, $interval, $formatted_start, $new_num_days, $new_num_hours, $rule['end-count']); break; case 'custom-weekly-on-same-time': case 'custom-weekly-never-same-time': $text = sprintf($text, $interval, $weekdays, $num_days, $num_hours, $formatted_end); break; case 'custom-weekly-after-same-time': $text = sprintf($text, $interval, $weekdays, $num_days, $num_hours, $rule['end-count']); break; case 'custom-weekly-on-diff-time': case 'custom-weekly-never-diff-time': $text = sprintf($text, $interval, $weekdays, $formatted_start, $new_num_days, $new_num_hours, $formatted_end); break; case 'custom-weekly-after-diff-time': $text = sprintf($text, $interval, $weekdays, $formatted_start, $new_num_days, $new_num_hours, $rule['end-count']); break; case 'custom-monthly-on-same-time-numeric': case 'custom-monthly-never-same-time-numeric': case 'custom-monthly-on-same-time': case 'custom-monthly-never-same-time': $text = sprintf($text, $interval, $month_day_description, $num_days, $num_hours, $formatted_end); break; case 'custom-monthly-after-same-time-numeric': case 'custom-monthly-after-same-time': $text = sprintf($text, $interval, $month_day_description, $num_days, $num_hours, $rule['end-count']); break; case 'custom-monthly-on-diff-time-numeric': case 'custom-monthly-never-diff-time-numeric': case 'custom-monthly-on-diff-time': case 'custom-monthly-never-diff-time': $text = sprintf($text, $interval, $month_day_description, $formatted_start, $new_num_days, $new_num_hours, $formatted_end); break; case 'custom-monthly-after-diff-time-numeric': case 'custom-monthly-after-diff-time': $text = sprintf($text, $interval, $month_day_description, $formatted_start, $new_num_days, $new_num_hours, $rule['end-count']); break; case 'custom-yearly-on-same-time-unfiltered': case 'custom-yearly-never-same-time-unfiltered': case 'custom-yearly-on-same-time': case 'custom-yearly-never-same-time': $text = sprintf($text, $interval, $months, $month_day_description, $num_days, $num_hours, $formatted_end); break; case 'custom-yearly-after-same-time-unfiltered': case 'custom-yearly-after-same-time': $text = sprintf($text, $interval, $months, $month_day_description, $num_days, $num_hours, $rule['end-count']); break; case 'custom-yearly-on-diff-time-unfiltered': case 'custom-yearly-never-diff-time-unfiltered': case 'custom-yearly-on-diff-time': case 'custom-yearly-never-diff-time': $text = sprintf($text, $interval, $months, $month_day_description, $formatted_start, $new_num_days, $new_num_hours, $formatted_end); break; case 'custom-yearly-after-diff-time-unfiltered': case 'custom-yearly-after-diff-time': $text = sprintf($text, $interval, $months, $month_day_description, $formatted_start, $new_num_days, $new_num_hours, $rule['end-count']); break; } return $text; }
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; }
/** * Sets the page title for the various PRO views. * * @param string $title The current title. * * @return string The modified title. */ public function reset_page_title($title, $depth = true) { global $wp_query; $tec = Tribe__Events__Main::instance(); $date_format = apply_filters('tribe_events_pro_page_title_date_format', tribe_get_date_format(true)); if (tribe_is_showing_all()) { $reset_title = sprintf(__('All %1$s for %2$s', 'tribe-events-calendar-pro'), strtolower($this->plural_event_label), get_the_title()); } // week view title if (tribe_is_week()) { $reset_title = sprintf(__('%1$s for week of %2$s', 'tribe-events-calendar-pro'), $this->plural_event_label, date_i18n($date_format, strtotime(tribe_get_first_week_day($wp_query->get('start_date'))))); } if (!empty($reset_title) && is_tax($tec->get_event_taxonomy()) && $depth) { $cat = get_queried_object(); $reset_title = '<a href="' . tribe_get_events_link() . '">' . $reset_title . '</a>'; $reset_title .= ' › ' . $cat->name; } return isset($reset_title) ? $reset_title : $title; }
foreach ($orders as $order_id => $attendees) { ?> <?php $first_attendee = reset($attendees); // Fetch the actual Provider $provider = call_user_func(array($first_attendee['provider'], 'get_instance')); $order = call_user_func_array(array($provider, 'get_order_data'), array($order_id)); ?> <li class="tribe-item" id="order-<?php echo esc_html($order_id); ?> "> <div class="user-details"> <p> <?php printf(esc_html__('Order #%1$s: %2$s reserved by %3$s (%4$s) on %5$s', 'event-tickets-plus'), esc_html($order_id), sprintf(_n(esc_html('1 Ticket'), esc_html('%d Tickets'), count($attendees), 'event-tickets-plus'), count($attendees)), esc_attr($order['purchaser_name']), '<a href="mailto:' . esc_url($order['purchaser_email']) . '">' . esc_html($order['purchaser_email']) . '</a>', date_i18n(tribe_get_date_format(true), strtotime(esc_attr($order['purchase_time'])))); ?> </p> <?php if (!Tribe__Tickets_Plus__Attendees_List::is_hidden_on(get_the_ID())) { /** * Inject content into the Tickets User Details block on the orders page * * @param array $attendee_group Attendee array * @param WP_Post $post_id Post object that the tickets are tied to */ do_action('event_tickets_user_details_tickets', $attendees, $post_id); } ?> </div> <ul class="tribe-tickets-list tribe-list">