Use Looper to List Options from a custom Select

Good morning Themeco! I’m trying to use loopers + dynamic content to loop through and list out the options for a custom select dropdown I’ve made in ACF. The select dropdown is “State” and the choices in the State are all of the states. I’d like to somehow loop through all of these options and display them, ideally only if they have a posts with the specific state.

For better understanding… in our use-case, we have a directory of businesses within all 52 states/territories. We’re looking to create a dynamic list with only states that have businesses within them.

I was initially thinking something like this {{dc:acf:post_field_setting field="state" key="label"}} would work, but I’m unsure exactly how to loop through all of the custom terms.

Thanks for your continued support!

Hi @SJF_me,

Thanks for reaching out!

If you mean to display the select option you created on your ACF field, then regretfully, there’s no option to pull it off using the Looper.

Thank you.

Is there another way - without using the looper - to do this? Even if it requires writing a shortcode function? I’m just trying to find a way that lists out all of the states which have posts assigned to them, one way or another.

Hi @SJF_me,

There are some other ways to acheive this, but the Looper Provider is the efficient way to do this. I would suggest you hire a developer who can assist you to do the customization or you can avail of our newly launched service called One, where the customization questions are answered.

Thanks

@tristup - I’m confused, could you (or someone) please clarify?

You’re saying the most efficient way to do this is via the Looper…

but @marc_a says that there is no option to do this with the Looper…

Also, I am the developer that would be doing the customization. So, if this is possible via Looper, then I’d appreciate any guidance.

Hello @SJF_me,

The select option will only output return a value or label. You cannot output the choices.

For some reference: Using ACF Pro 'Select' fields with Dynamic Content - How to get 'label' rather than 'value'?

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