SHARE
TWEET

List future recurring instances

BakerMan Jan 13th, 2014 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top