Support

Account

Home Forums Feature Requests Checkbox empty values labels

Solved

Checkbox empty values labels

  • hello everyone,
    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?

    thanks in advance for any suggestion

  • Are you returning the value, label or an array for the checkbox field? This information would be needed to write code.

    The example here on showing displaying the value and label is old but it has the basics https://www.advancedcustomfields.com/contact/

    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)

The topic ‘Checkbox empty values labels’ is closed to new replies.