Guest User

List.php

a guest
May 21st, 2013
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.33 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. <?php the_title('<h2 class="entry-title" itemprop="name"><a href="' . tribe_get_event_link() . '" title="' . the_title_attribute('echo=0') . '" rel="bookmark">', '</a></h2>'); ?>
  41. <div class="entry-content tribe-events-event-entry" itemprop="description">
  42. <?php if (has_excerpt ()): ?>
  43. <?php the_excerpt(); ?>
  44. <?php else: ?>
  45. <?php the_content(); ?>
  46. <?php endif; ?>
  47. </div> <!-- End tribe-events-event-entry -->
  48.  
  49. <div class="tribe-events-event-list-meta" itemprop="location" itemscope itemtype="http://schema.org/Place">
  50. <table cellspacing="0">
  51. <?php if (tribe_is_multiday() || !tribe_get_all_day()): ?>
  52. <tr>
  53. <td class="tribe-events-event-meta-desc"><?php _e('Start:', 'tribe-events-calendar'); ?></td>
  54. <td class="tribe-events-event-meta-value" itemprop="startDate" content="<?php echo tribe_get_start_date(); ?>"><?php echo tribe_get_start_date(); ?></td>
  55. </tr>
  56. <tr>
  57. <td class="tribe-events-event-meta-desc"><?php _e('End:', 'tribe-events-calendar'); ?></td>
  58. <td class="tribe-events-event-meta-value" itemprop="endDate" content="<?php echo tribe_get_end_date(); ?>"><?php echo tribe_get_end_date(); ?></td>
  59. </tr>
  60. <?php else: ?>
  61. <tr>
  62. <td class="tribe-events-event-meta-desc"><?php _e('Date:', 'tribe-events-calendar'); ?></td>
  63. <td class="tribe-events-event-meta-value" itemprop="startDate" content="<?php echo tribe_get_start_date(); ?>"><?php echo tribe_get_start_date(); ?></td>
  64. </tr>
  65. <?php endif; ?>
  66.  
  67. <?php
  68. $venue = tribe_get_venue();
  69. if ( !empty( $venue ) ) :
  70. ?>
  71. <tr>
  72. <td class="tribe-events-event-meta-desc"><?php _e('Venue:', 'tribe-events-calendar'); ?></td>
  73. <td class="tribe-events-event-meta-value" itemprop="name">
  74. <?php if( class_exists( 'TribeEventsPro' ) ): ?>
  75. <?php tribe_get_venue_link( get_the_ID(), class_exists( 'TribeEventsPro' ) ); ?>
  76. <?php else: ?>
  77. <?php echo tribe_get_venue( get_the_ID() ); ?>
  78. <?php endif; ?>
  79. </td>
  80. </tr>
  81. <?php endif; ?>
  82. <?php
  83. $phone = tribe_get_phone();
  84. if ( !empty( $phone ) ) :
  85. ?>
  86. <tr>
  87. <td class="tribe-events-event-meta-desc"><?php _e('Phone:', 'tribe-events-calendar'); ?></td>
  88. <td class="tribe-events-event-meta-value" itemprop="telephone"><?php echo $phone; ?></td>
  89. </tr>
  90. <?php endif; ?>
  91. <?php if (tribe_address_exists( get_the_ID() ) ) : ?>
  92. <tr>
  93. <td class="tribe-events-event-meta-desc"><?php _e('Address:', 'tribe-events-calendar'); ?><br />
  94. <?php if( get_post_meta( get_the_ID(), '_EventShowMapLink', true ) == 'true' ) : ?>
  95. <a class="gmap" itemprop="maps" href="<?php echo tribe_get_map_link(); ?>" title="Click to view a Google Map" target="_blank"><?php _e('Google Map', 'tribe-events-calendar' ); ?></a>
  96. <?php endif; ?></td>
  97. <td class="tribe-events-event-meta-value"><?php echo tribe_get_full_address( get_the_ID() ); ?></td>
  98. </tr>
  99. <?php endif; ?>
  100. <?php
  101. $cost = tribe_get_cost();
  102. if ( !empty( $cost ) ) :
  103. ?>
  104. <tr>
  105. <td class="tribe-events-event-meta-desc"><?php _e('Cost:', 'tribe-events-calendar'); ?></td>
  106. <td class="tribe-events-event-meta-value" itemprop="price"><?php echo $cost; ?></td>
  107. </tr>
  108. <?php endif; ?>
  109. </table>
  110. </div>
  111. </div> <!-- End post -->
  112. <?php endwhile;// posts ?>
  113. <?php else :?>
  114. <div class="tribe-events-no-entry">
  115. <?php
  116. $tribe_ecp = TribeEvents::instance();
  117. if ( is_tax( $tribe_ecp->get_event_taxonomy() ) ) {
  118. $cat = get_term_by( 'slug', get_query_var('term'), $tribe_ecp->get_event_taxonomy() );
  119. if( tribe_is_upcoming() ) {
  120. $is_cat_message = sprintf(__(' listed under %s. Check out past events for this category or view the full calendar.','tribe-events-calendar'),$cat->name);
  121. } else if( tribe_is_past() ) {
  122. $is_cat_message = sprintf(__(' listed under %s. Check out upcoming events for this category or view the full calendar.','tribe-events-calendar'),$cat->name);
  123. }
  124. }
  125. ?>
  126. <?php if(tribe_is_day()): ?>
  127. <?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')))); ?>
  128. <?php endif; ?>
  129.  
  130. <?php if(tribe_is_upcoming()){ ?>
  131. <?php _e('No upcoming events', 'tribe-events-calendar');
  132. echo !empty($is_cat_message) ? $is_cat_message : "."; ?>
  133.  
  134. <?php }elseif(tribe_is_past()){ ?>
  135. <?php _e('No previous events' , 'tribe-events-calendar');
  136. echo !empty($is_cat_message) ? $is_cat_message : "."; ?>
  137. <?php } ?>
  138. </div>
  139. <?php endif; ?>
  140.  
  141.  
  142. </div><!-- #tribe-events-loop -->
  143. <div id="tribe-events-nav-below" class="tribe-events-nav clearfix">
  144.  
  145. <div class="tribe-events-nav-previous"><?php
  146. // Display Previous Page Navigation
  147. if( tribe_is_upcoming() && get_previous_posts_link() ) : ?>
  148. <?php previous_posts_link( '<span>'.__('&laquo; Previous Events', 'tribe-events-calendar').'</span>' ); ?>
  149. <?php elseif( tribe_is_upcoming() && !get_previous_posts_link( ) ) : ?>
  150. <a href='<?php echo tribe_get_past_link(); ?>'><span><?php _e('&laquo; Previous Events', 'tribe-events-calendar' ); ?></span></a>
  151. <?php elseif( tribe_is_past() && get_next_posts_link( ) ) : ?>
  152. <?php next_posts_link( '<span>'.__('&laquo; Previous Events', 'tribe-events-calendar').'</span>' ); ?>
  153. <?php endif; ?>
  154. </div>
  155.  
  156. <div class="tribe-events-nav-next"><?php
  157. // Display Next Page Navigation
  158. if( tribe_is_upcoming() && get_next_posts_link( ) ) : ?>
  159. <?php next_posts_link( '<span>'.__('Next Events &raquo;', 'tribe-events-calendar').'</span>' ); ?>
  160. <?php elseif( tribe_is_past() && get_previous_posts_link( ) ) : ?>
  161. <?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 ?>
  162. <?php elseif( tribe_is_past() && !get_previous_posts_link( ) ) : ?>
  163. <a href='<?php echo tribe_get_upcoming_link(); ?>'><span><?php _e('Next Events &raquo;', 'tribe-events-calendar'); ?></span></a>
  164. <?php endif; ?>
  165. </div>
  166.  
  167. </div>
  168. <?php if ( !empty($hasPosts) && function_exists('tribe_get_ical_link') ): ?>
  169. <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>
  170. <?php endif; ?>
  171. </div>
Advertisement
Add Comment
Please, Sign In to add comment