Advertisement
BakerMan

Alternative display_day() to show only day 1 of a multiday

Jun 24th, 2013
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.24 KB | None | 0 0
  1. function display_day( $day, $monthView ) {
  2.     global $post;
  3.     static $already_displayed = array();
  4.  
  5.     for ( $i = 0; $i < count( $monthView[$day] ); $i++ ) {
  6.         $post = $monthView[$day][$i];
  7.         setup_postdata( $post );
  8.  
  9.         $eventId    = $post->ID.'-'.$day;
  10.         $start      = tribe_get_start_date( $post->ID, false, 'U' );
  11.         $end        = tribe_get_end_date( $post->ID, false, 'U' );
  12.  
  13.         if (in_array($post->ID, $already_displayed) and !tribe_is_recurring_event($post->ID)) continue;
  14.         $already_displayed[] = $post->ID;
  15.         ?>
  16.         <div id='event_<?php echo $eventId; ?>' <?php post_class('tribe-events-event tribe-events-real-event') ?>>
  17.             <a href="<?php tribe_event_link(); ?>"><?php the_title(); ?></a>
  18.             <div id='tooltip_<?php echo $eventId; ?>' class="tribe-events-tooltip" style="display:none;">
  19.                 <h5 class="tribe-events-event-title"><?php the_title();?></h5>
  20.                 <div class="tribe-events-event-body">
  21.                     <div class="tribe-events-event-date">
  22.                         <?php if ( !empty( $start ) )   echo date_i18n( get_option('date_format', 'F j, Y'), $start);
  23.                         if ( !tribe_get_event_meta($post->ID, '_EventAllDay', true) )
  24.                             echo ' ' . date_i18n( get_option('time_format', 'g:i a'), $start); ?>
  25.                         <?php if ( !empty( $end )  && $start !== $end ) {
  26.                             if ( date_i18n( 'Y-m-d', $start ) == date_i18n( 'Y-m-d', $end ) ) {
  27.                                 $time_format = get_option( 'time_format', 'g:i a' );
  28.                                 if ( !tribe_get_event_meta($post->ID, '_EventAllDay', true) )
  29.                                     echo " – " . date_i18n( $time_format, $end );
  30.                             } else {
  31.                                 echo " – " . date_i18n( get_option('date_format', 'F j, Y'), $end);
  32.                                 if ( !tribe_get_event_meta($post->ID, '_EventAllDay', true) )
  33.                                     echo ' ' . date_i18n( get_option('time_format', 'g:i a'), $end) . '<br />';
  34.                             }
  35.                         } ?>
  36.                     </div>
  37.                     <?php if ( function_exists('has_post_thumbnail') && has_post_thumbnail() ) { ?>
  38.                         <div class="tribe-events-event-thumb"><?php the_post_thumbnail( array(75,75));?></div>
  39.                     <?php } ?>
  40.                     <?php echo has_excerpt() ? TribeEvents::truncate($post->post_excerpt) : TribeEvents::truncate(get_the_content(), 30); ?>
  41.  
  42.                 </div>
  43.                 <span class="tribe-events-arrow"></span>
  44.             </div>
  45.         </div>
  46.         <?php
  47.         if( $i < count( $monthView[$day] ) - 1 ) {
  48.             echo "<hr />";
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement