Support

Account

Home Forums General Issues Loop through all rows of ACF group without specifying row name Reply To: Loop through all rows of ACF group without specifying row name

  • Thanks John,

    Think there were a couple of tiny typos but that works great. And I added my feeds_per_day variable in the for loop to show the right amount of meals. Perfect!

    for ($i=1; $i<$feeds_per_day + 1; $i++) {
    if (have_rows('meal_'.$i)) {
        while (have_rows('meal_'.$i)) {
          the_row();
    		
          // get sub fields and do calulations
          
          ?><tr><td>Meal <?php echo $i; ?></td><td><?php echo more stuff ?></td></tr><?php
        } // end while
      } // end if meal
    } // end for