Retrieving Field Data inside ACF Repeated Group Fields

Good Morning,

this topic is a follow-up to ACF Repeater Field in a Looper where @Kennyboy7 has posted a solution (PHP Filter) to retrieve ACF field data inside an ACF Repeater Field.

I on the other hand need to retrieve data from ACF Group fields that are inside an ACF Repeater, and each group has 5 fields inside it.

I am trying to retrieve the data from those fields from inside PRO layout builder using META dynamic data, but the filter mentioned above is not working.

Anyone knows a solution?

Here is a screenshot of the field disposition inside ACF:

Hi @BuzzStory,

It might be an upcoming feature for the next few succeeding releases. I would request you wait for the next update or if you want this to be done with this version it required custom development, which is beyond the scope of theme support. I would suggest you hire a developer who can assist you to do the customization.

Thanks

Hi @tristup,

i was able to solve the problem today, and decided to share.

Even though PRO still does not allow this function i was able to solve the matter using a basic WP shortcode, which i then used on the custom post LAYOUT.

@Kennyboy7 was using an ACF php filter, so making a custom shorcode should prove to be even easier.

So i have a repeater field, inside that repeater i have a group field with 5 data fields (text, numbers, etc.),

It is used by placing a shorcode named [indirizzi]

in order to retrieve the data from those 5 fields (on this example i only fetch 2 of those)and print it on page i used the following function:

function print_acf_repeater_groups() {

// Check rows exists.
if( have_rows('indirizzi') ):
    // Loop through rows.
    while( have_rows('indirizzi') ) : the_row();

				// Do something...

					//sub-loop
					if( have_rows('lista-indirizzi') ):
						while( have_rows('lista-indirizzi') ): the_row();

						$indirizzo_formattato = get_sub_field('via_o_piazza') . ' ' . get_sub_field('citta');

						echo $indirizzo_formattato;

						// End loop.
						endwhile; endif;

    // End loop.
    endwhile;

		// No value.
		else :
    // Do something...
		endif;

 return; }

add_shortcode('indirizzi', 'print_acf_repeater_groups');

it is simple, and much more could be added depending on your context, but i hope it helps as a starting point for someone.

Hey Brigham,

We are glad you’ve figured out a way to resolve your issue.
Thank you very much for sharing the information of how you have done it.

Cheers.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.