• Hello,

    I have added a checkbox with the field name of tabs_used using the following choices

    Overview : Overview
    Experience : Experience
    Publications : Publications
    Community : Community
    Recognition : Recognition

    I would like to display the value or label for a particular checkbox only but cannot seem to get it to work per the documentation.

    Here’s what I have and no return value is shown:

    <?php
    $field = get_field_object('tabs_used');
    $value = get_field('tabs_used');
    $label = $field['Experience'][ $value ];
    ?>
    <h2><?php echo $label; ?></h2>

    I have changed the $field[] section to ‘choices’ but this give me an error “Warning: Illegal offset type in”

    How can I display the value or label of only one particular checkbox choice in my checkbox options?

    https://wordpress.org/plugins/advanced-custom-fields/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Show a Checkbox choice label or value’ is closed to new replies.