Support

Account

Home Forums Add-ons Repeater Field Counting fields of a nested repeater

Solving

Counting fields of a nested repeater

  • I would generally use

    $count = count( get_field('feature_description_repeater') );

    To count the number of fields a repeater has. However with a nested repeater his doesn’t work. DOes anyone know how to count a nested repeater? ๐Ÿ™‚

  • +1 for this I’m looking for a solution as well.

  • Ok I’ve tried this and it works

    Basically I put this code in the 1st repeater while…loop,
    before the nested repeater starts.

    $count = count(get_sub_field('sub_repeater_field_name'))

    hope it helps

  • ACF support gave me the following solution which worked for me.

    $rows = get_sub_field('sub_field_of_repeater');
    if( have_rows('sub_field_of_repeater') ):
    $count = count($rows);
Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Counting fields of a nested repeater’ is closed to new replies.