Support

Account

Home Forums Reply To:

  • 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