Home Forums Add-ons Repeater Field Repeater for a list of date Reply To: Repeater for a list of date

  • Hi @ikazi

    Something like the code below should do the trick…

    In it, I loop through the repeater, and add only non-expired dates to an array..
    .. then I sort it… then… you can loop through the result set. Give it a try and let me know 🙂

    $repeater = get_field('list_of_date');
    foreach( $repeater as $key => $row ) {
      if ( strtotime( $row['date_end'] ) > strtotime( date() ) ) { // not expired, add to array
        $column_id[ $key ] = $row['date_start'];
    array_multisort( $column_id, SORT_ASC, $repeater ); // sort the array
    foreach( $repeater as $row ) {
      // loop through the array