Home Forums General Issues Displaying Multiple Values & Labels


Displaying Multiple Values & Labels

  • Hey guys,
    So I’ve been really digging almost all of ACF’s functionality, but have gotten stuck on a way I’m trying to use checkbox choices.
    What I want to achieve is a list of checkbox choices with website links as values and region names as labels.

    I saw in the checkbox documentation that there is a way to display a single value and it’s label and a way to display multiple values, but I didn’t see anything regarding displaying multiple labels.

    Ideally what I want to accomplish is use each checkbox to display a button with the text from the label and the value as a link for that button.

    Any help would be greatly appreciated,

  • This should get you on the right track, just modify the echo to make a button:

      $full_object = get_field_object('field_name_here');
      foreach($full_object['value'] as $value){
        // $value is the 'value'
        $label = $full_object['choices'][$value];
    } ?>
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Displaying Multiple Values & Labels’ is closed to new replies.