Advertisement
BakerMan

Revised list.php (1vertica)

May 8th, 2013
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.71 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. global $wootickets_pricing;
  13. global $wootickets_no_show;
  14. $wootickets_no_show = true;
  15. ?>
  16. <div id="tribe-events-content" class="upcoming">
  17.  
  18.     <?php if(!tribe_is_day()): // day view doesn't have a grid ?>
  19.         <div id='tribe-events-calendar-header' class="clearfix">
  20.         <span class='tribe-events-calendar-buttons'>
  21.             <a class='tribe-events-button-on' href='<?php echo tribe_get_listview_link(); ?>'><?php _e('Event List', 'tribe-events-calendar'); ?></a>
  22.             <a class='tribe-events-button-off' href='<?php echo tribe_get_gridview_link(); ?>'><?php _e('Calendar', 'tribe-events-calendar'); ?></a>
  23.         </span>
  24.  
  25.         </div><!--tribe-events-calendar-header-->
  26.     <?php endif; ?>
  27.     <div id="tribe-events-loop" class="tribe-events-events post-list clearfix">
  28.  
  29.         <?php if (have_posts()) : ?>
  30.             <?php $hasPosts = true; $first = true; ?>
  31.             <?php while ( have_posts() ) : the_post(); ?>
  32. <?php
  33. // Does the event span multiple days?
  34.                 if (tribe_is_multiday()) {
  35.                     // When does the event start and what day is today?
  36.                     $startDate = tribe_get_start_date(null, false, 'Ymd');
  37.                     $today = tribe_event_format_date(strtotime(get_query_var('eventDate')), false, 'Ymd');
  38.  
  39.                     // If it started *before* today, let's give it a miss
  40.                     if ($startDate < $today) continue;
  41.                 }
  42.                 ?>
  43.                 <?php global $more; $more = false; ?>
  44.                 <div id="post-<?php the_ID(); ?>" <?php post_class('tribe-events-event clearfix'); ?> itemscope itemtype="http://schema.org/Event">
  45.                     <?php if ( tribe_is_new_event_day() && !tribe_is_day() && !tribe_is_multiday() ) : ?>
  46.                         <h4 class="event-day"><?php echo tribe_get_start_date( null, false ); ?></h4>
  47.                     <?php endif; ?>
  48.                     <?php if( !tribe_is_day() && tribe_is_multiday() ) : ?>
  49.                         <h4 class="event-day"><?php echo tribe_get_start_date( null, false ); ?><?php echo tribe_get_end_date( null, false ); ?></h4>
  50.                     <?php endif; ?>
  51.                     <?php if ( tribe_is_day() && $first ) : $first = false; ?>
  52.                         <h4 class="event-day"><?php echo tribe_event_format_date(strtotime(get_query_var('eventDate')), false); ?></h4>
  53.                     <?php endif; ?>
  54.                     <?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>'); ?>
  55.                     <div class="entry-content tribe-events-event-entry" itemprop="description">
  56.                         <?php if (has_excerpt ()): ?>
  57.                             <?php the_excerpt(); ?>
  58.                         <?php else: ?>
  59.                             <?php the_content(); ?>
  60.                         <?php endif; ?>
  61.                         <?php
  62.                             tribe_get_ticket_form();
  63.                             $price_differential = max($wootickets_pricing) > min($wootickets_pricing);
  64.  
  65.                             if (count($wootickets_pricing) === 1 or !price_differential) {
  66.                                 $price = woocommerce_price($wootickets_pricing[0]);
  67.                                 echo "Tickets cost $price";
  68.                             }
  69.                             elseif (count($wootickets_pricing) > 1) {
  70.                                 $from = woocommerce_price(min($wootickets_pricing));
  71.                                 $to = woocommerce_price(max($wootickets_pricing));
  72.                                 echo "Tickets from $from &ndash; $to";
  73.                             }
  74.                         ?>
  75.  
  76.                     </div> <!-- End tribe-events-event-entry -->
  77.  
  78.                     <div class="tribe-events-event-list-meta" itemprop="location" itemscope itemtype="http://schema.org/Place">
  79.                         <table cellspacing="0">
  80.                             <?php
  81.                             // Get the start date and end date
  82.                             $date_output = tribe_get_start_date(null, false);
  83.                             $end_date = tribe_get_end_date(null, false);
  84.  
  85.                             // Only show the end date if it is different to the start date
  86.                             if ($date_output !== $end_date) $date_output .= " &ndash; $end_date";
  87.  
  88.                             // If it is an all day event then say so
  89.                             if (tribe_get_all_day()) $time_output = '(All day event)';
  90.  
  91.                             // Otherwise show the start-end times
  92.                             else $time_output = tribe_get_start_date(null, false, get_option('time_format')).' &ndash; '
  93.                                 .tribe_get_end_date(null, false, get_option('time_format'));
  94.                             ?>
  95.                             <tr>
  96.                                 <td class="tribe-events-event-meta-desc"><?php _e('Date:', 'tribe-events-calendar') ?></td>
  97.                                 <td class="tribe-events-event-meta-value"><?php esc_html_e($date_output) ?></td>
  98.                             </tr>
  99.                             <tr>
  100.                                 <td class="tribe-events-event-meta-desc"><?php _e('Time:', 'tribe-events-calendar') ?></td>
  101.                                 <td class="tribe-events-event-meta-value"><?php esc_html_e($time_output) ?></td>
  102.                             </tr>
  103.  
  104.                             <?php
  105.                             $venue = tribe_get_venue();
  106.                             if ( !empty( $venue ) ) :
  107.                                 ?>
  108.                                 <tr>
  109.                                     <td class="tribe-events-event-meta-desc"><?php _e('Venue:', 'tribe-events-calendar'); ?></td>
  110.                                     <td class="tribe-events-event-meta-value" itemprop="name">
  111.                                         <?php if( class_exists( 'TribeEventsPro' ) ): ?>
  112.                                             <?php tribe_get_venue_link( get_the_ID(), class_exists( 'TribeEventsPro' ) ); ?>
  113.                                         <?php else: ?>
  114.                                             <?php echo tribe_get_venue( get_the_ID() ); ?>
  115.                                         <?php endif; ?>
  116.                                     </td>
  117.                                 </tr>
  118.                             <?php endif; ?>
  119.                             <?php
  120.                             $phone = tribe_get_phone();
  121.                             if ( !empty( $phone ) ) :
  122.                                 ?>
  123.                                 <tr>
  124.                                     <td class="tribe-events-event-meta-desc"><?php _e('Phone:', 'tribe-events-calendar'); ?></td>
  125.                                     <td class="tribe-events-event-meta-value" itemprop="telephone"><?php echo $phone; ?></td>
  126.                                 </tr>
  127.                             <?php endif; ?>
  128.                             <?php if (tribe_address_exists( get_the_ID() ) ) : ?>
  129.                                 <tr>
  130.                                     <td class="tribe-events-event-meta-desc"><?php _e('Address:', 'tribe-events-calendar'); ?><br />
  131.                                         <?php if( get_post_meta( get_the_ID(), '_EventShowMapLink', true ) == 'true' ) : ?>
  132.                                             <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>
  133.                                         <?php endif; ?></td>
  134.                                     <td class="tribe-events-event-meta-value"><?php echo tribe_get_full_address( get_the_ID() ); ?></td>
  135.                                 </tr>
  136.                             <?php endif; ?>
  137.                             <?php
  138.                             $cost = tribe_get_cost();
  139.                             if ( !empty( $cost ) ) :
  140.                                 ?>
  141.                                 <tr>
  142.                                     <td class="tribe-events-event-meta-desc"><?php _e('Cost:', 'tribe-events-calendar'); ?></td>
  143.                                     <td class="tribe-events-event-meta-value" itemprop="price"><?php echo $cost; ?></td>
  144.                                 </tr>
  145.                             <?php endif; ?>
  146.                         </table>
  147.                     </div>
  148.                 </div> <!-- End post -->
  149.             <?php endwhile;// posts ?>
  150.         <?php else :?>
  151.             <div class="tribe-events-no-entry">
  152.                 <?php
  153.                 $tribe_ecp = TribeEvents::instance();
  154.                 if ( is_tax( $tribe_ecp->get_event_taxonomy() ) ) {
  155.                     $cat = get_term_by( 'slug', get_query_var('term'), $tribe_ecp->get_event_taxonomy() );
  156.                     if( tribe_is_upcoming() ) {
  157.                         $is_cat_message = sprintf(__(' listed under %s. Check out past events for this category or view the full calendar.','tribe-events-calendar'),$cat->name);
  158.                     } else if( tribe_is_past() ) {
  159.                         $is_cat_message = sprintf(__(' listed under %s. Check out upcoming events for this category or view the full calendar.','tribe-events-calendar'),$cat->name);
  160.                     }
  161.                 }
  162.                 ?>
  163.                 <?php if(tribe_is_day()): ?>
  164.                     <?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')))); ?>
  165.                 <?php endif; ?>
  166.  
  167.                 <?php if(tribe_is_upcoming()){ ?>
  168.                     <?php _e('No upcoming events', 'tribe-events-calendar');
  169.                     echo !empty($is_cat_message) ? $is_cat_message : "."; ?>
  170.  
  171.                 <?php }elseif(tribe_is_past()){ ?>
  172.                     <?php _e('No previous events' , 'tribe-events-calendar');
  173.                     echo !empty($is_cat_message) ? $is_cat_message : "."; ?>
  174.                 <?php } ?>
  175.             </div>
  176.         <?php endif; ?>
  177.  
  178.  
  179.     </div><!-- #tribe-events-loop -->
  180.     <div id="tribe-events-nav-below" class="tribe-events-nav clearfix">
  181.  
  182.         <div class="tribe-events-nav-previous"><?php
  183.             // Display Previous Page Navigation
  184.             if( tribe_is_upcoming() && get_previous_posts_link() ) : ?>
  185.                 <?php previous_posts_link( '<span>'.__('&laquo; Previous Events', 'tribe-events-calendar').'</span>' ); ?>
  186.             <?php elseif( tribe_is_upcoming() && !get_previous_posts_link( ) ) : ?>
  187.                 <a href='<?php echo tribe_get_past_link(); ?>'><span><?php _e('&laquo; Previous Events', 'tribe-events-calendar' ); ?></span></a>
  188.             <?php elseif( tribe_is_past() && get_next_posts_link( ) ) : ?>
  189.                 <?php next_posts_link( '<span>'.__('&laquo; Previous Events', 'tribe-events-calendar').'</span>' ); ?>
  190.             <?php endif; ?>
  191.         </div>
  192.  
  193.         <div class="tribe-events-nav-next"><?php
  194.             // Display Next Page Navigation
  195.             if( tribe_is_upcoming() && get_next_posts_link( ) ) : ?>
  196.                 <?php next_posts_link( '<span>'.__('Next Events &raquo;', 'tribe-events-calendar').'</span>' ); ?>
  197.             <?php elseif( tribe_is_past() && get_previous_posts_link( ) ) : ?>
  198.                 <?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 ?>
  199.             <?php elseif( tribe_is_past() && !get_previous_posts_link( ) ) : ?>
  200.                 <a href='<?php echo tribe_get_upcoming_link(); ?>'><span><?php _e('Next Events &raquo;', 'tribe-events-calendar'); ?></span></a>
  201.             <?php endif; ?>
  202.         </div>
  203.  
  204.     </div>
  205.     <?php if ( !empty($hasPosts) && function_exists('tribe_get_ical_link') ): ?>
  206.         <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>
  207.     <?php endif; ?>
  208. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement