Hi guys can you help me to fix my issue? Basically, I added a div to my acf repeater items but I need 3 items per div
<?php
$course_reference = get_field(‘course-reference-number’);
$program_id = get_field(‘course-program-id’);
if( have_rows(‘course_month_out’) ):
while( have_rows(‘course_month_out’) ) : the_row();
$count = 0;
$group = 0;
if( have_rows(‘course_schedule_row_dates’) ):
while( have_rows(‘course_schedule_row_dates’) ) : the_row();
$course_date_selector = get_sub_field(‘course_date_selector’);
$course_date_url = date(‘d-m-y’, strtotime($course_date_selector));
$current_date_field = get_sub_field(‘course_date_selector’, false, false);
$currentDateTime = date(‘Ymd’);
if ($count % 3 == 0) {
$group++;
?>
<div class=”course_block”>
<?php
}
if($current_date_field < $currentDateTime) {
}
else {
?>
<?php if(get_row_index() > 1 ){ echo “,”;}?>
” target=”_blank”> <?php echo $course_date_selector; ?>
<?php
}
if ($count % 3 == 2) {
?>
</div>
<?php
}
$count++;
endwhile;
endif;
endwhile;
endif;
Here’s the screenshot of the expected output and the current output of this code
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.