Using the ACF field "Checkbox" --> How to output Label and Value separately

Hello,

I need to create a “Checkbox” or “Select” field, where the user will select the appropriate studio location for a given movie. On the front-end I would like the outputted studio name to also be clickable, since each studio has its own page.

I realized that using the field type “Checkbox”, I can have a URL and the name both displayed together in the choices section. Then in the Return Value section, I can choose Value, Label or Both (Array).

In the Layout Builder, how to display both but separately? (the chosen studio name + its URL). I would have the name displayed as a Headline and the URL set up as a link.

Thanks!

Emile

Hi Emile,

Thanks for reaching out.
I would suggest you go through the following thread on a similar topic.

https://theme.co/forum/t/acf-options-field-array-single-value/86816/4

Hope it helps.
Thanks

Hi Tristup,

Thanks for the quick reply. The link you provided seems broken.

Thanks!

Emile

Hello Emile,

You may need to be logged in to your Themeco account to access the page. Anyways, if you’re using the options field type with Array as the return type you can access the content like this:

{{dc:looper:field key="value"}}
{{dc:looper:field key="label"}}

Hope this helps.

Hi Ruenel,

Thanks for your answer. I tried using the provided code but I seem to be missing something.

Do I need to set a looper provider for this to work? My Checkbox field type “select_studio” is set to output as Array, but nothing shows up on the front-end.

Thanks again

Emile

Hi Emile,

Would you mind sharing your credentials so that we can check on your setup properly? To do that, please give us the following information in a Secure Note.

  • WordPress Login URL
  • Admin level username and password

You can find the Secure Note button at the bottom of your posts.

Thank you.

Hello,
Thank you. Credentials added in a secure note.

Hi @emile,

We can’t visit your website because it is asking sign-in login, please provide the details in the secure note so that we can check your setup properly.

Thank you.

Hey Marc,

Sorry about that, I forgot it was there. Credentials added in secure note.
Thanks!

Hey @Emile,

The given credentials are not working for us. It seems that the password is incorrect.

Please double-check. Thanks.

Hey Ruenel,

Please see the updated password attached in a secure note.
Thanks again for your help.

Hi @emile,

You need a looper provider to access the value and label of your checkbox ACF field. The looper provider should be set to Dynamic content and the input is {{dc:acf:post_field field=“select_studio”}}. Then you can use the dynamic content inside the text element or your chosen element.

{{dc:looper:field key="value"}}
{{dc:looper:field key="label"}}

Hope that helps.

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