Advertisement
BakerMan

Modified Upcoming Event List

Sep 9th, 2012
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.78 KB | None | 0 0
  1. <?php
  2. /**
  3. * The TEC template for a list of events. This has been modified to
  4. * remove:
  5. *
  6. *   .tribe-events-event-list-meta table
  7. */
  8.  
  9. // Don't load directly
  10. if ( !defined('ABSPATH') ) { die('-1'); }
  11.  
  12. ?>
  13.  
  14. <div id="tribe-events-content" class="upcoming">
  15.  
  16.     <?php if(!tribe_is_day()): // day view doesn't have a grid ?>
  17.         <div id='tribe-events-calendar-header' class="clearfix">
  18.         <span class='tribe-events-calendar-buttons'>
  19.             <a class='tribe-events-button-on' href='<?php echo tribe_get_listview_link(); ?>'><?php _e('Event List', 'tribe-events-calendar')?></a>
  20.             <a class='tribe-events-button-off' href='<?php echo tribe_get_gridview_link(); ?>'><?php _e('Calendar', 'tribe-events-calendar')?></a>
  21.         </span>
  22.  
  23.         </div><!--tribe-events-calendar-header-->
  24.     <?php endif; ?>
  25.     <div id="tribe-events-loop" class="tribe-events-events post-list clearfix">
  26.  
  27.     <?php if (have_posts()) : ?>
  28.     <?php $hasPosts = true; $first = true; ?>
  29.     <?php while ( have_posts() ) : the_post(); ?>
  30.         <?php global $more; $more = false; ?>
  31.         <div id="post-<?php the_ID() ?>" <?php post_class('tribe-events-event clearfix') ?> itemscope itemtype="http://schema.org/Event">
  32.             <?php if ( tribe_is_new_event_day() && !tribe_is_day() ) : ?>
  33.                 <h4 class="event-day"><?php echo tribe_get_start_date( null, false ); ?></h4>
  34.             <?php endif; ?>
  35.             <?php if ( tribe_is_day() && $first ) : $first = false; ?>
  36.                 <h4 class="event-day"><?php echo tribe_event_format_date(strtotime(get_query_var('eventDate')), false); ?></h4>
  37.             <?php endif; ?>
  38.                 <?php if ( function_exists('has_post_thumbnail') && has_post_thumbnail() ) {?>
  39.                 <?php
  40. /**
  41.  * One final variation could be to register a new post thumbnail
  42.  * size and use that in place of the default "post-thumbnail"
  43.  * size. Here I have used the notional "event-thumbnail" size.
  44.  *
  45.  * You would specify the target size in the thumbnail registration
  46.  * code, the benefit of this approach being that the image sent
  47.  * to the browser would be the correct size straight off the bat,
  48.  * no wasted bandwidth.
  49.  *
  50.  * If you want to find about more about registering post
  51.  * thumbnail sizes then see the following link.
  52.  *
  53.  * @see http://codex.wordpress.org/Function_Reference/add_image_size
  54.  */
  55. the_post_thumbnail('event-thumbnail', array(
  56.     'class' => 'featured-event-thumb',
  57. )); ?>
  58.                 <?php } ?>
  59.             <?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>'); ?>
  60.             <div class="entry-content tribe-events-event-entry" itemprop="description">
  61.                 <?php if (has_excerpt ()): ?>
  62.                     <?php the_excerpt(); ?>
  63.                 <?php else: ?>
  64.                     <?php the_content(); ?>
  65.                 <?php endif; ?>
  66.             </div> <!-- End tribe-events-event-entry -->
  67.  
  68.  
  69.         </div> <!-- End post -->
  70.     <?php endwhile;// posts ?>
  71.     <?php else :?>
  72.         <?php
  73.             $tribe_ecp = TribeEvents::instance();
  74.             if ( is_tax( $tribe_ecp->get_event_taxonomy() ) ) {
  75.                 $cat = get_term_by( 'slug', get_query_var('term'), $tribe_ecp->get_event_taxonomy() );
  76.                 if( tribe_is_upcoming() ) {
  77.                     $is_cat_message = sprintf(__(' listed under %s. Check out past events for this category or view the full calendar.','tribe-events-calendar'),$cat->name);
  78.                 } else if( tribe_is_past() ) {
  79.                     $is_cat_message = sprintf(__(' listed under %s. Check out upcoming events for this category or view the full calendar.','tribe-events-calendar'),$cat->name);
  80.                 }
  81.             }
  82.         ?>
  83.         <?php if(tribe_is_day()): ?>
  84.             <?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')))); ?>
  85.         <?php endif; ?>
  86.  
  87.         <?php if(tribe_is_upcoming()){ ?>
  88.             <?php _e('No upcoming events', 'tribe-events-calendar');
  89.             echo !empty($is_cat_message) ? $is_cat_message : ".";?>
  90.  
  91.         <?php }elseif(tribe_is_past()){ ?>
  92.             <?php _e('No previous events' , 'tribe-events-calendar');
  93.             echo !empty($is_cat_message) ? $is_cat_message : ".";?>
  94.         <?php } ?>
  95.  
  96.     <?php endif; ?>
  97.  
  98.  
  99.     </div><!-- #tribe-events-loop -->
  100.     <div id="tribe-events-nav-below" class="tribe-events-nav clearfix">
  101.  
  102.         <div class="tribe-events-nav-previous"><?php
  103.         // Display Previous Page Navigation
  104.         if( tribe_is_upcoming() && get_previous_posts_link() ) : ?>
  105.             <?php previous_posts_link( '<span>'.__('&laquo; Previous Events', 'tribe-events-calendar').'</span>' ); ?>
  106.         <?php elseif( tribe_is_upcoming() && !get_previous_posts_link( ) ) : ?>
  107.             <a href='<?php echo tribe_get_past_link(); ?>'><span><?php _e('&laquo; Previous Events', 'tribe-events-calendar' ); ?></span></a>
  108.         <?php elseif( tribe_is_past() && get_next_posts_link( ) ) : ?>
  109.             <?php next_posts_link( '<span>'.__('&laquo; Previous Events', 'tribe-events-calendar').'</span>' ); ?>
  110.         <?php endif; ?>
  111.         </div>
  112.  
  113.         <div class="tribe-events-nav-next"><?php
  114.         // Display Next Page Navigation
  115.         if( tribe_is_upcoming() && get_next_posts_link( ) ) : ?>
  116.             <?php next_posts_link( '<span>'.__('Next Events &raquo;', 'tribe-events-calendar').'</span>' ); ?>
  117.         <?php elseif( tribe_is_past() && get_previous_posts_link( ) ) : ?>
  118.             <?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 ?>
  119.         <?php elseif( tribe_is_past() && !get_previous_posts_link( ) ) : ?>
  120.             <a href='<?php echo tribe_get_upcoming_link(); ?>'><span><?php _e('Next Events &raquo;', 'tribe-events-calendar'); ?></span></a>
  121.         <?php endif; ?>
  122.         </div>
  123.  
  124.     </div>
  125.     <?php if ( !empty($hasPosts) && function_exists('tribe_get_ical_link') ): ?>
  126.         <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>
  127.     <?php endif; ?>
  128. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement