Support

Account

Home Forums ACF PRO Get list of all values and labels to use in a sidebar

Helping

Get list of all values and labels to use in a sidebar

  • We have a field group that has checkbox field type to chose from a list of cities. We’re able to display the chosen city for each post when looping through the posts, but what we want is a filter in the sidebar to only show posts for the selected city. Right now we have that working, but the list of cities is hard-coded in the sidebar. What we want to do is pull the list of valid choices and use those in the sidebar.

    The documentation I’m seeing all assumes you’re inside the post loop…unless I’m just not looking in the right place.

    Is what we’re trying to do possible? Right now it’s a pain when we want to update/modify the list of valid cities. We edit the custom field, then have to also edit the template to match.

  • Make group show on an option page.

    Then retrieve the value with get_field('field_name', 'option').

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.