Trying to loop through Advanced Custom Fields’ (ACF) repeater fields? This quick guide will show you how to output the plugin’s results.
2 answers
0
Understanding WordPress loops
Loops are a big part of WordPress. Loops are how WordPress runs through pages, posts and custom post types. You can use the PHP while function to loop through these.
— Support WizardAnswer 1
1
Using while loops with the ACF repeater field
- Create a repeater field in ACF;
- Add subfields to your repeater;
- Use the PHP code below and adapt this to your repeater’s name and subfields.
while ( have_rows ( 'repeater_name' ) ) : the_row() echo get_sub_field( 'first_subfield_name' ); echo get_sub_field( 'second_subfield_name' ); endwhile;
— Support WizardAnswer 2