Support

Account

Home Forums Add-ons Repeater Field looping nested repeaters Reply To: looping nested repeaters

  • the first problem I see is that you are trying to use get_sub_field() outside of a have_rows() loop.

    correct loop using have_rows()

    
    if (have_rows('collections')) {
      while (have_rows('collections')) {
        the_row();
        $banners = get_sub_field('banners');
      }
    }
    

    correct loop using array

    
    $collections = get_field('collections');
    foreach ($collections as $collection) {
      $banners = $collection['banners'];
    }
    

    The other thing is this $banners.count(); should be count($banners)