Advertisement
BakerMan

Modified list.php template (date-time)

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