Advertisement
BakerMan

Simplified Upcoming Events List

Dec 3rd, 2012
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.79 KB | None | 0 0
  1. <?php
  2. /**
  3.  * The TEC template for a list of events. This includes the Past Events and Upcoming Events views
  4.  * as well as those same views filtered to a specific category.
  5.  *
  6.  * You can customize this view by putting a replacement file of the same name (list.php) in the events/ directory of your theme.
  7.  */
  8.  
  9. // Don't load directly
  10. if ( !defined('ABSPATH') ) { die('-1'); }
  11.  
  12. ?>
  13. <div id="tribe-events-content" class="upcoming">
  14.  
  15.     <?php if(!tribe_is_day()): // day view doesn't have a grid ?>
  16.     <div id='tribe-events-calendar-header' class="clearfix">
  17.         <span class='tribe-events-calendar-buttons'>
  18.             <a class='tribe-events-button-on' href='<?php echo tribe_get_listview_link(); ?>'><?php _e('Event List', 'tribe-events-calendar'); ?></a>
  19.             <a class='tribe-events-button-off' href='<?php echo tribe_get_gridview_link(); ?>'><?php _e('Calendar', 'tribe-events-calendar'); ?></a>
  20.         </span>
  21.  
  22.     </div><!--tribe-events-calendar-header-->
  23.     <?php endif; ?>
  24.     <div id="tribe-events-loop" class="tribe-events-events post-list clearfix">
  25.  
  26.         <?php if (have_posts()) : ?>
  27.         <?php $hasPosts = true; $first = true; ?>
  28.         <?php while ( have_posts() ) : the_post(); ?>
  29.             <?php global $more; $more = false; ?>
  30.             <div id="post-<?php the_ID(); ?>" <?php post_class('tribe-events-event clearfix'); ?> itemscope itemtype="http://schema.org/Event">
  31.                 <?php if ( tribe_is_new_event_day() && !tribe_is_day() && !tribe_is_multiday() ) : ?>
  32.                     <h4 class="event-day"><?php echo tribe_get_start_date( null, false ); ?></h4>
  33.                 <?php endif; ?>
  34.                 <?php if( !tribe_is_day() && tribe_is_multiday() ) : ?>
  35.                     <h4 class="event-day"><?php echo tribe_get_start_date( null, false ); ?><?php echo tribe_get_end_date( null, false ); ?></h4>
  36.                 <?php endif; ?>
  37.                 <?php if ( tribe_is_day() && $first ) : $first = false; ?>
  38.                     <h4 class="event-day"><?php echo tribe_event_format_date(strtotime(get_query_var('eventDate')), false); ?></h4>
  39.                 <?php endif; ?>
  40.  
  41.                     <p><?php the_title('<a href="' . tribe_get_event_link() . '" title="' . the_title_attribute('echo=0') . '" rel="bookmark">', '</a>'); ?>
  42.                     <?php if (tribe_is_multiday() || !tribe_get_all_day()): ?>
  43.                         <?php _e('Start:', 'tribe-events-calendar'); ?>
  44.                         <?php echo tribe_get_start_date(); ?>
  45.                         <?php _e('End:', 'tribe-events-calendar'); ?>
  46.                         <?php echo tribe_get_end_date(); ?>
  47.                     <?php else: ?>
  48.                         <?php _e('Date:', 'tribe-events-calendar'); ?>
  49.                         <?php echo tribe_get_start_date(); ?>
  50.                     <?php endif; ?>
  51.  
  52.                     <?php if( class_exists( 'TribeEventsPro' ) ): ?>
  53.                         <?php tribe_get_venue_link( get_the_ID(), class_exists( 'TribeEventsPro' ) ); ?>
  54.                     <?php else: ?>
  55.                         <?php echo tribe_get_venue( get_the_ID() ); ?>
  56.                     <?php endif; ?></p>
  57.  
  58.             <?php endwhile;// posts ?>
  59.         <?php else :?>
  60.         <div class="tribe-events-no-entry">
  61.             <?php
  62.             $tribe_ecp = TribeEvents::instance();
  63.             if ( is_tax( $tribe_ecp->get_event_taxonomy() ) ) {
  64.                 $cat = get_term_by( 'slug', get_query_var('term'), $tribe_ecp->get_event_taxonomy() );
  65.                 if( tribe_is_upcoming() ) {
  66.                     $is_cat_message = sprintf(__(' listed under %s. Check out past events for this category or view the full calendar.','tribe-events-calendar'),$cat->name);
  67.                 } else if( tribe_is_past() ) {
  68.                     $is_cat_message = sprintf(__(' listed under %s. Check out upcoming events for this category or view the full calendar.','tribe-events-calendar'),$cat->name);
  69.                 }
  70.             }
  71.             ?>
  72.             <?php if(tribe_is_day()): ?>
  73.             <?php printf( __('No events scheduled for <strong>%s</strong>. Please try another day.', 'tribe-events-calendar'), date_i18n('F d, Y', strtotime(get_query_var('eventDate')))); ?>
  74.             <?php endif; ?>
  75.  
  76.             <?php if(tribe_is_upcoming()){ ?>
  77.             <?php _e('No upcoming events', 'tribe-events-calendar');
  78.             echo !empty($is_cat_message) ? $is_cat_message : "."; ?>
  79.  
  80.             <?php }elseif(tribe_is_past()){ ?>
  81.             <?php _e('No previous events' , 'tribe-events-calendar');
  82.             echo !empty($is_cat_message) ? $is_cat_message : "."; ?>
  83.             <?php } ?>
  84.         </div>
  85.         <?php endif; ?>
  86.  
  87.  
  88.     </div><!-- #tribe-events-loop -->
  89.     <div id="tribe-events-nav-below" class="tribe-events-nav clearfix">
  90.  
  91.         <div class="tribe-events-nav-previous"><?php
  92.             // Display Previous Page Navigation
  93.             if( tribe_is_upcoming() && get_previous_posts_link() ) : ?>
  94.                 <?php previous_posts_link( '<span>'.__('&laquo; Previous Events', 'tribe-events-calendar').'</span>' ); ?>
  95.                 <?php elseif( tribe_is_upcoming() && !get_previous_posts_link( ) ) : ?>
  96.                 <a href='<?php echo tribe_get_past_link(); ?>'><span><?php _e('&laquo; Previous Events', 'tribe-events-calendar' ); ?></span></a>
  97.                 <?php elseif( tribe_is_past() && get_next_posts_link( ) ) : ?>
  98.                 <?php next_posts_link( '<span>'.__('&laquo; Previous Events', 'tribe-events-calendar').'</span>' ); ?>
  99.                 <?php endif; ?>
  100.         </div>
  101.  
  102.         <div class="tribe-events-nav-next"><?php
  103.             // Display Next Page Navigation
  104.             if( tribe_is_upcoming() && get_next_posts_link( ) ) : ?>
  105.                 <?php next_posts_link( '<span>'.__('Next Events &raquo;', 'tribe-events-calendar').'</span>' ); ?>
  106.                 <?php elseif( tribe_is_past() && get_previous_posts_link( ) ) : ?>
  107.                 <?php previous_posts_link( '<span>'.__('Next Events &raquo;', 'tribe-events-calendar').'</span>' ); // a little confusing but in 'past view' to see newer events you want the previous page ?>
  108.                 <?php elseif( tribe_is_past() && !get_previous_posts_link( ) ) : ?>
  109.                 <a href='<?php echo tribe_get_upcoming_link(); ?>'><span><?php _e('Next Events &raquo;', 'tribe-events-calendar'); ?></span></a>
  110.                 <?php endif; ?>
  111.         </div>
  112.  
  113.     </div>
  114.     <?php if ( !empty($hasPosts) && function_exists('tribe_get_ical_link') ): ?>
  115.     <a title="<?php esc_attr_e('iCal Import', 'tribe-events-calendar'); ?>" class="ical" href="<?php echo tribe_get_ical_link(); ?>"><?php _e('iCal Import', 'tribe-events-calendar'); ?></a>
  116.     <?php endif; ?>
  117. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement