Home Forums Add-ons Repeater Field Order Repeater Field by Date


Order Repeater Field by Date

  • I’m trying to get my repeater to order by dates.

    I’m close but as you can see the dates are not quite right. Any help with tunning my query to display the dates correctly would be much appreciated!

    $repeater = get_field('upcoming_program_dates');
    $order = array();
    foreach( $repeater as $i => $row ) {
        $order[ $i ] = $row['date'];
    array_multisort( $order, SORT_DESC, $repeater );
    if( $repeater ): ?>
        <?php foreach( $repeater as $i => $row ): ?>
          <p><?php echo $row['date']; ?> - <?php echo $row['date_end']; ?></p>    
        <?php endforeach; ?>
    <?php endif; ?>

    ACF Repeater Dates

Viewing 1 post (of 1 total)

The topic ‘Order Repeater Field by Date’ is closed to new replies.