Advertisement
BakerMan

Show start-end for recurring events (ECP 2.0.11 single.php)

Feb 6th, 2013
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1. <dt>Date range</dt>
  2. <dd><?php
  3.     // Find the start and end dates
  4.     $recurrence = TribeEventsRecurrenceMeta::getRecurrenceMeta(get_the_ID());
  5.     $final = isset($recurrence['recEnd']) ? $recurrence['recEnd'] : false;
  6.     $start = get_post_meta(get_the_ID(), '_EventStartDate', true);
  7.  
  8.     // Do we have what we are looking for?
  9.     if ($final !== false and !empty($start)) {
  10.         // Format both dates
  11.         $start = new DateTime($start);
  12.         $start = $start->format(get_option('date_format'));
  13.        
  14.         $final = new DateTime($final);
  15.         $final = $final->format(get_option('date_format'));
  16.  
  17.         // Display!
  18.         echo "$start until $final";
  19.     }
  20. ?></dd>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement