Support

Account

Home Forums Add-ons Repeater Field Calendar by month with date repeater Reply To: Calendar by month with date repeater

  • Hi @trainsrenton

    In this case, you need to sort the repeater first. Please check this page to learn more about it: https://www.advancedcustomfields.com/resources/how-to-sorting-a-repeater-field/. Please keep in mind that you need to change the order based on the date like this:

    $order[ $i ] = $row['jour_debut'];

    To show the month only once, you need to store the month in a variable and check it in the loop like this:

    $current_date = null;
    <?php foreach( $repeater as $i => $row ): ?>
        
        if( $current_date != $row['jour_debut'] ){
            echo '<h1>'.$row['jour_debut'].'</h1>';
            $current_month = $row['jour_debut'];
        }
    
    <?php endforeach; ?>

    I hope this helps 🙂