Correct syntax for calling value/label of an ACF nested repeater field

Hi,
I am currently exploring more advanced capabilities of ACF. In Themeco Docs, I found that if an ACF field returns both ‘value’ and ‘label’, I can access ‘label’ by using this syntax:
{{dc:acf:post_field field="type" type="object" key="label"}}

If the ACF field is in the root, that works fine, but what if I need to call ‘label’ for a nested repeater filed? Which syntax should I use if by default we call ‘value’ by using this string?
{{ looper.field({"key":"type"}) }}

It seems like the "key" parameter is already used in this case to grab the field value.

Hi John,

Thanks for reaching out.
I would suggest you go through the following thread, where the Nested structure, which might help you on this.

If that does not help, we need to investigate the structure you made through the WordPress admin dashboard. I would suggest you please provide login credentials for your site in a secure note to examine it further, including:

– WordPress Site URL & Login URL
– WordPress Admin username/password
– Specific page where you have used it. Please also mention the section where you applied the looper.

To create a secure note, click the key icon underneath any of your posts.

Thanks

Dear @tristup,

Unfortunately that thread doesn’t cover the topic I am referring to.

I test this out at a component page with preview set to ‘спортсмен’ with any of two records available for that ACF Custom Post Type.

My structure is the following:

Tabs Element with Dynamic Content Looper Provider set to
{{dc:acf:post_field field="athlete_achievements"}}

There I have Tab Labels which pull up the years for “athlete_achievements” and set to:
set to {{ looper.field({"key":"season"}) }}

On the same level I added a div element to hold the strings of data from the nested repeater which is set to
{{dc:looper:field key="event"}}

And finally inside the div there is a Text Element which outputs the nested field data:
{{ looper.field({"key":"place"}) }} | {{ looper.field({"key":"type" }) }} | {{ looper.field({"key":"group" }) }} | {{ looper.field({"key":"discipline" }) }} | {{ looper.field({"key":"city" }) }}

Some nested fields return both ‘value’ and ‘label’. I want to show the ‘label’ instead of the ‘value’ for {{ looper.field({"key":"type" }) }} but I can’t find the right syntax since the “key” is already used for the field name. If I change the output to one the ‘value’ or the ‘label’ data is shown properly. But I wonder if that possible to keep both outputs and to use the one you need on each instance including nested repeater is similar fashion as I described in my initial post for regulat root ACF fields.

I will provide access credentials in this post secure note in a minute.

Hey John,

You may use this instead:

<p><strong>TYPE:</strong> <br />
{{ looper.field({"key":"type.label"}) }} => {{ looper.field({"key":"type.value"}) }}</p>

Check out the demo in the secure note below.

Thanks.

1 Like

Thanks, @ruenel.

This syntax works as expected. Good to know that.