Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End FOR loop with counter in variables Re: FOR loop with counter in variables

#135742
dclardy
Member

Does this work for you?

# for 3 items, your loop should be from =1 to <4
for( $i=1; $i<4; $i++ ){

# write the item name as a string and pass it to your function
the_field( ‘”product_image_’.$i.'”‘ );
}

Are you using advanced custom fields?