Advertisement
BakerMan

Link to month view from widget title (TEC 3.0)

Jul 16th, 2013
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.98 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Mini Calendar Widget Grid Template: this override makes it so that the month title (ie, SEP 2013) links to the
  4.  * month view.
  5.  */
  6. if ( !defined('ABSPATH') ) { die('-1'); }
  7.  
  8. $days_of_week = tribe_events_get_days_of_week('short');
  9. $week = 0;
  10. ?>
  11. <div class="tribe-mini-calendar-grid-wrapper">
  12.     <table class="tribe-mini-calendar" <?php tribe_events_the_mini_calendar_header_attributes() ?>>
  13.         <thead class="tribe-mini-calendar-nav">
  14.             <tr>
  15.                 <td colspan="7">
  16.                     <div>
  17.                     <?php
  18.                     tribe_events_the_mini_calendar_prev_link();
  19.  
  20.                     $args = tribe_events_get_mini_calendar_args();
  21.                     $event_date = isset($args['eventDate']) ? $args['eventDate'] : '';
  22.  
  23.                     if (!empty($event_date)) {
  24.                         $month_link = TribeEvents::instance()->getLink('month', substr($event_date, 0, 7), null);
  25.                     }
  26.  
  27.                     if (isset($month_link)) {
  28.                         echo '<a href="' . $month_link . '">';
  29.                     }
  30.  
  31.                     echo '<span id="tribe-mini-calendar-month">';
  32.                     tribe_events_the_mini_calendar_title();
  33.                     echo '</span>';
  34.  
  35.                     if (isset($month_link)) {
  36.                         echo '</a>';
  37.                     }
  38.  
  39.                     tribe_events_the_mini_calendar_next_link();
  40.                     ?>
  41.                     <img id="ajax-loading-mini" src="<?php echo tribe_events_resource_url( 'images/tribe-loading.gif' ) ?>" alt="loading..." />
  42.                     </div>
  43.                 </td>
  44.             </tr>
  45.         </thead>
  46.  
  47.     <thead>
  48.         <tr>
  49.         <?php foreach($days_of_week as $day) : ?>
  50.             <th class="tribe-mini-calendar-dayofweek"><?php echo $day ?></th>
  51.         <?php endforeach; ?>           
  52.  
  53.         </tr>
  54.     </thead>
  55.    
  56.  
  57.         <tbody class="hfeed vcalendar">
  58.  
  59.             <tr>
  60.             <?php while (tribe_events_have_month_days()) : tribe_events_the_month_day(); ?>
  61.                 <?php if ($week != tribe_events_get_current_week()) : $week++; ?>
  62.             </tr>
  63.             <tr>
  64.                 <?php endif; ?>
  65.                 <td class="<?php tribe_events_the_month_day_classes() ?>">
  66.                         <?php tribe_get_template_part('widgets/mini-calendar/single-day') ?>
  67.                 </td>
  68.             <?php endwhile; ?>
  69.             </tr>
  70.         </tbody>
  71.     </table>
  72. </div> <!-- .tribe-mini-calendar-grid-wrapper -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement