Advertisement
BakerMan

List future recurring instances

Jan 13th, 2014
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.51 KB | None | 0 0
  1. <?php
  2. if ( tribe_is_recurring_event() ) {
  3.     $dates = get_post_meta( get_the_ID(), '_EventStartDate' );
  4.     $this_date = tribe_get_start_date( null, false, 'Y-m-d H:i:s' );
  5.     $future_instances = array();
  6.  
  7.     foreach ( $dates as $date ) if ( $date > $this_date ) {
  8.         $instance_date = new DateTime( $date );
  9.         $future_instances[] = ' ' . $instance_date->format( get_option( 'date_format' ) ) . ' ';
  10.     }
  11.  
  12.     if ( ! empty( $future_instances ) ) {
  13.         echo 'Also taking place on ' . join( '|', $future_instances );
  14.     }
  15. }
  16. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement