示例#1
0
/**
 * Output a link for the mini calendar day, includes data attributes needed to update the event list below with ajax
 *
 * @return void
 **/
function tribe_events_the_mini_calendar_day_link()
{
    $day = tribe_events_get_current_month_day();
    $args = tribe_events_get_mini_calendar_args();
    if ($day['total_events'] > 0) {
        // there are events on this day
        if ($args['count'] > 0) {
            // there is an event list under the calendar
            $html = '<a href="#" data-day="' . $day['date'] . '" class="tribe-mini-calendar-day-link">' . $day['daynum'] . '</a>';
        } else {
            // there are no events under the calendar
            if (tribe_events_is_view_enabled('day')) {
                // day view is enabled
                ob_start();
                tribe_the_day_link($day['date'], $day['daynum']);
                $html = ob_get_clean();
            } else {
                // day view is disabled, just show that there are events on the day but don't link anywhere
                $html = '<a href="javascript:void(0)">' . $day['daynum'] . '</a>';
            }
        }
    } else {
        $html = '<span class="tribe-mini-calendar-no-event">' . $day['daynum'] . '</span>';
    }
    echo apply_filters('tribe_events_the_mini_calendar_day_link', $html);
}
 /**
  * Pick the correct template to include
  *
  * @param string $template Path to template
  *
  * @return string Path to template
  */
 public static function templateChooser($template)
 {
     $events = Tribe__Events__Main::instance();
     do_action('tribe_tec_template_chooser', $template);
     // no non-events need apply
     if (!tribe_is_event_query()) {
         return $template;
     }
     // if it's a single 404 event
     if (is_single() && is_404()) {
         return get_404_template();
     }
     if (!is_single() && !tribe_events_is_view_enabled($events->displaying) && 'day' != $events->displaying) {
         return get_404_template();
     }
     // add the theme slug to the body class
     add_filter('body_class', array(__CLASS__, 'theme_body_class'));
     // add the template name to the body class
     add_filter('body_class', array(__CLASS__, 'template_body_class'));
     // user has selected a page/custom page template
     if (tribe_get_option('tribeEventsTemplate', 'default') != '') {
         if (!is_single() || !post_password_required()) {
             add_action('loop_start', array(__CLASS__, 'setup_ecp_template'));
         }
         $template = locate_template(tribe_get_option('tribeEventsTemplate', 'default') == 'default' ? 'page.php' : tribe_get_option('tribeEventsTemplate', 'default'));
         if ($template == '') {
             $template = get_index_template();
         }
         // remove singular body class if sidebar-page.php
         if ($template == get_stylesheet_directory() . '/sidebar-page.php') {
             add_filter('body_class', array(__CLASS__, 'remove_singular_body_class'));
         } else {
             add_filter('body_class', array(__CLASS__, 'add_singular_body_class'));
         }
     } else {
         $template = self::getTemplateHierarchy('default-template');
     }
     // if this is an oembed, override the wrapping template and use the embed template
     if (Tribe__Templates::is_embed()) {
         $template = self::getTemplateHierarchy('embed');
     }
     self::$template = $template;
     return $template;
 }
示例#3
0
	<!-- Events List -->
	<?php 
    while ($day['events']->have_posts()) {
        $day['events']->the_post();
        ?>
		<?php 
        tribe_get_template_part('month/single', 'event');
        ?>
	<?php 
    }
    ?>

	<!-- View More -->
	<?php 
    if ($day['view_more'] && tribe_events_is_view_enabled('day')) {
        ?>
		<div class="tribe-events-viewmore">
			<?php 
        $view_all_label = sprintf(_n('View 1 Event', 'View All %s Events', $day['total_events'], 'tribe-events-calendar'), $day['total_events']);
        ?>
			<a href="<?php 
        echo $day['view_more'];
        ?>
"><?php 
        echo $view_all_label;
        ?>
 &raquo;</a>
		</div>
	<?php 
    }
示例#4
0
 /**
  * Return the text used in week day headers wrapped in a <span> tag and data attribute needed for mobile js.
  *
  * @return string
  */
 function tribe_events_week_day_header()
 {
     $day = tribe_events_week_get_current_day();
     $html = '<span data-full-date="' . $day['formatted_date'] . '">' . $day['formatted_date'] . '</span>';
     // if day view is enabled and there are events on the day, make it a link to the day
     if (tribe_events_is_view_enabled('day') && $day['has_events']) {
         $html = '<a href="' . tribe_get_day_link(tribe_events_week_get_the_date(false)) . '" rel="bookmark">' . $html . '</span></a>';
     }
     return apply_filters('tribe_events_week_day_header', $html);
 }
 * @package TribeEventsCalendar
 *
 */
if (!defined('ABSPATH')) {
    die('-1');
}
$day = tribe_events_get_current_month_day();
$events_label = 1 === $day['total_events'] ? tribe_get_event_label_singular() : tribe_get_event_label_plural();
?>
<!-- Day Header -->
<div id="tribe-events-daynum-<?php 
echo $day['daynum-id'];
?>
">
	<?php 
if ($day['total_events'] > 0 && tribe_events_is_view_enabled('day')) {
    ?>
		<a href="<?php 
    echo esc_url(tribe_get_day_link($day['date']));
    ?>
"><?php 
    echo $day['daynum'];
    ?>
</a>
	<?php 
} else {
    ?>
		<?php 
    echo $day['daynum'];
    ?>
	<?php 
示例#6
0
</span>
		</div>
		<div class="tribe-grid-content-wrap">
			<?php 
while (tribe_events_week_have_days()) {
    tribe_events_week_the_day();
    ?>
				<div title="<?php 
    tribe_events_week_get_the_date();
    ?>
" class="column <?php 
    echo tribe_events_week_is_current_today() ? 'tribe-week-today' : '';
    ?>
">
					<?php 
    if (tribe_events_is_view_enabled('day') && tribe_events_current_week_day_has_events()) {
        ?>
						<a href="<?php 
        echo tribe_get_day_link(tribe_events_week_get_the_date(false));
        ?>
" rel="bookmark"><?php 
        tribe_events_week_get_the_day_display();
        ?>
</a>
					<?php 
    } else {
        ?>
						<?php 
        tribe_events_week_get_the_day_display();
        ?>
					<?php