Advertisement
Guest User

Untitled

a guest
Nov 11th, 2013
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.30 KB | None | 0 0
  1. if ( !defined('ABSPATH') ) { die('-1'); } ?>
  2.  
  3. <?php
  4.     function asdf_check_first_friday( $date_to_check, $year, $month ) {
  5.    
  6.     // get first friday:
  7.     $this_months_friday = new DateTime( 'first friday ' . $year . "-" . $month );
  8.     if( strtotime( $this_months_friday->format( 'M j' )) == strtotime( $date_to_check )) :
  9.        //echo "first friday!!!";
  10.         return true;
  11.     else : // aint first friday chief
  12.         return false;
  13.     endif;
  14.    
  15. }
  16. ?>
  17.  
  18. <?php $day = tribe_events_get_current_month_day(); $rr = 0; ?>
  19.  
  20. <?php if ($day['date'] != 'previous' && $day['date'] != 'next') : ?>
  21.  
  22.     <!-- Day Header -->
  23.     <div id="tribe-events-daynum-<?php echo $day['daynum'] ?>">
  24.         <a href="<?php echo tribe_get_day_link($day['date']) ?>"><?php echo $day['daynum'] ?></a>
  25.     </div>
  26.    
  27.     <?php   $date_parts = explode( '-', $day['date'] ); // or split()
  28.     if( asdf_check_first_friday( $day['date'], $date_parts[0], $date_parts[1] )) :
  29.         ?><span class="its-first-friday-grid" style="display:none;">First Friday<br><a href="<?php echo tribe_get_day_link($day['date']) ?>">View Events</a></span>
  30.     <?php else : ?>        
  31.    
  32.         <!-- Events List -->
  33.         <?php while ($day['events']->have_posts()) : $day['events']->the_post(); ?>
  34.                 <?php tribe_get_template_part( 'month/single', 'event' ); ?>
  35.         <?php endwhile; ?>
  36.        
  37.     <?php endif; ?>
  38.  
  39. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement