I’m using a certain number of checkbox connected to a post, to list out the features of a family of products, some product has all the feature others just few.
The idea is to show a list of labels and beside the label an icon to show if the product has or not that feature.
When I do the loop in the checkbox array, I only get those which have been checked.
There is any setting that i can use or code to write to get all the labels, and only the values of those checked?
What you need to do is get the field object. Then instead of looping over the values that are checked you loop over all of the values in $field['choices'] and you display them all and you check to see if that value has been set in the field value, if it is you show one thing and if it’s not you show another.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users