ACF - How to do a foreach loop on pinegrow


I´m displaying some fields from ACF, and I got into a problem
I need to display this:

<?php // lugar_de_atencion ( value )
$lugar_de_atencion_array = get_field( 'lugar_de_atencion' );
if ( $lugar_de_atencion_array ):
	foreach ( $lugar_de_atencion_array as $lugar_de_atencion_item ):
	 	echo $lugar_de_atencion_item;
endif; ?>

Well… what I did was, to create a div, and instead of adding a custom PHP code (like I do for single elemens display) I just right-click on the div, and do “Edit Code”, and inserted the PHP code.

It worked… but I wanna know if there is any proper way to do it, to insert a code like that, so I can format it adding paragraphs and h1, and other stuff inside the foreach, and properly see it in the pinegrow tree?

Please, If you take a look at the screenshot, I can show you what I did (put the phocode doing right-click and adding it) I wanna add that I tried to add it doing the “preview php-code” but i was unable to edit it.

That does not look like wordpress code to me. They use loops, the loop, do loop or something instead of foreach, I have not used wordpress in years though. Sorry I couldn’t help.

I personally do not use Pinegrow to code, I use it for displaying of content, themes and css stuff. I found PG a pain for coding PHP and other behind the scenes stuff not directly related to display. How do you find the WP version for creating themes?

Hi Terry44,

That loop is what i got from ACF to display one of the fields.

About the WP version for creating themes , i don´t understand what you mean?

tx, Bruno.

You seem to be using Pinegrow to create Wordpress Themes. I personally do not do this. I was curious how your experience was using Pinegrow as a Wordpress Theme designer.

Please, have a look at this:

Best regards.