ACF Link field array

I use some ACF to build up an easy portfolio template.

Within the ACF I use a repeating field that contains “button” fields (title + url). When using “Link-URL” as output of the field I get the correct URL. Therefor I just use “{{dc:looper:field key=“button”}}”, but not the link title. When changing the output to “Link-Array” I get both - title + url separated by a “,”.

The container containing the button uses {{dc:acf:post_field field=“reference_buttons”}} (a repeating ACF field) as a looper provider. It works since it outputs all sub fields of the repeating field.

What do I need to add to the “{{dc:looper:field key=“button”}}” to just get the first and/or second element only of the array so I can use e.g. array element [0] on the button text and array element [1] as the url? Or is there a complete different way?

Hope I explained my problem good enough :slight_smile: .

Hi @mircotripoczky,

Thanks for reaching out.
It’s a very well explained problem, it might be an issue with the Nested Repeaters of ACF. I would suggest you go through the following article on this and specifically the Nested Repeaters section.

Main Article: https://theme.co/docs/acf-pro-and-loopers
Nested Repeater Section: https://theme.co/docs/acf-pro-and-loopers#nested-repeaters

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

– WordPress Site URL & Login URL
– Any specific page where you have using the ACF field.
– WordPress Admin username/password

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

Thanks

Hi Mirco,

If it is not possible to give access to your live site, I would suggest please copy your live site to a staging server and give us access in the secure note including:

– WordPress Site URL & Login URL
– Any specific page where you have using the ACF field.
– WordPress Admin username/password

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

And please go through the article given in the last post, before you share the above credentials

Thanks

Thanks @tristup

I’ll give you access to the site which is staging mode right now.

thanks and best regards
Mirco

Hi Mirco,

I have just consulted with the development team and found that the Link Array does not work with the Dynamic Content tags. I would suggest you create two different fields to take Title and URL separately.

Thanks for understanding.

Hi @tristup

too bad. I also had the idea to do with two fields, just wanted to make it easier for the client to add new content by herself.

Thanks for trying and best regards
Mirco

Hi Mirco,

You are most welcome.

Hm… now I’m running somehow into the same issue when using two fields of a group within a repeating field.

– “Buttons” (repeating field) - {{dc:acf:post_field field=“buttons”}}
---- “Links” (group) - {{dc:looper:field key=“Links”}} - result: “Name,URL”
------- “Name” (text single line) - how to get this alone?
------- “URL” (text single line - how to get this alone?

If I understand the the instructions at https://theme.co/docs/acf-pro-and-loopers#nested-repeaters correct, it should be {{dc:looper:field key=“name”}} and {{dc:looper:field key=“url”}}, because I’m in the looper already , but there is no result.

Best regards
Mirco

Hi Mirco,

It seems that you have nested the fields multiple time, so you may need to assign the Dynamic Content in the Looper Provider for {{dc:acf:post_field field=“buttons”}} and then in nested ** {{dc:looper:field key=“Links”}}** before you print {{dc:looper:field key=“name”}} and {{dc:looper:field key=“url”}}.

I have also tried to check at your WordPress admin dashboard, but unfortunately, the previously shared credentials are not working anymore. If you have already tried the given steps and that didn’t work, please provide login credentials once again in the secure note to examine it further, including:

Thanks

Hi @tristup

will do. I just broke something because the builder is not loading on the page anymore… going to fix it first :slight_smile:

Best regards and thanks
Mirco

Edit: While fixing what I broke, I rebuild the whole nested thingy the following way and it works now. Thanks for your food for thought :slight_smile:

– Row - {{dc:acf:post_field field=“buttons”}} & Looper Consumer (all)
---- Column within the row - {{dc:looper:field key=“Links”}} & Looper Consumer (all)
------Button within that column: {{dc:looper:field key=“name”}} for the button text and {{dc:looper:field key=“name”}} for the button link.

Problem solved. :slight_smile:

Hello @mircotripoczky,

It’s good to know that your issue has been resolved. If there is anything else we can help you with, please do not hesitate to open another thread.

Best Regards.

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