I have a repeater setup with 4 sub-fields. The page that the repeater resides on has roughly 30 rows of info. What I want to do is split-up the rows in groups of 6. Below is the structure I’m looking to accomplish:
SHOW FIRST 6 ROWS
- [row 1]
- [row 2]
- [row 3]
- [row 4]
- [row 5]
- [row 6]
SOME CONTENT
SHOW ROWS 7 THROUGH 12
- [row 7]
- [row 8]
- [row 9]
- [row 10]
- [row 11]
- [row 12]
SOME CONTENT
SHOW ROWS 13 THROUGH 18
- [row 13]
- [row 14]
- [row 15]
- [row 16]
- [row 17]
- [row 18]
… ETC.
<?php
$count = 0;
$your_repeater = get_field('your_repeater');
if($your_repeater){
while( have_rows('your_repeater') ): the_row();
$count++;
$my_field = get_sub_field('my_field');
echo '<div class="row">'.$my_field.'</div>';
if ($count == 6) {
echo '<div class="somecontent">getcontent6</div>';
}
if ($count == 12) {
echo '<div class="somecontent">getcontent12</div>';
}
if ($count == 18) {
echo '<div class="somecontent">getcontent18</div>';
}
if ($count == 24) {
echo '<div class="somecontent">getcontent24</div>';
}
endwhile;
}
?>
with that code every 6 row your additional row with content is added