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

#135759
Senff
Participant

@dclardy: yep, advanced custom fields.


@traq
: yup, that works! Finally, thanks.

I think the whole confusion is rooted in the way quotes have to be used. It sure confused me, because of the double quotes (see @melindrea’s comment), but it does seem the way to go. This is what I’ll end up with, although I can’t fully wrap my head around why it’s working….

for( $i=1; $i<4; $i++ ){
if( get_field( “product_image_$i” ) ){ echo get_field( “product_image_$i” ); }
}