Home › Forums › Add-ons › Repeater Field › Calendar by month with date repeater › Reply To: Calendar by month with date repeater
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 🙂
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.