Support

Account

Home Forums General Issues ACF, checkboxes and arrays.

Unread

ACF, checkboxes and arrays.

  • Hi there,

    I’m looking at doing the following using ACF and PHP arrays. In essence, the fields are checkboxes – when multiple boxes are checked, I want multiple values show. If individual ones are checked, only their values should show.

    Here is my code:

    <?php $fittings = get_field(‘fittings’); ?>

    <?php if(in_array(‘ledPanel’, get_field(‘fittings’), TRUE ) ) {
    echo ‘

  • ‘;
    echo ‘‘;
    echo ‘LED Panel‘;
    echo ‘
    ‘;
    echo ‘
  • ‘;
    } elseif(in_array(‘ledBatten’, get_field(‘fittings’), TRUE ) ) {
    echo ‘

  • ‘;
    echo ‘‘;
    echo ‘LED Batten‘;
    echo ‘
    ‘;
    echo ‘
  • ‘;
    }
    elseif(in_array(‘ledHighbay’, get_field(‘fittings’), TRUE ) ) {
    echo ‘

  • ‘;
    echo ‘‘;
    echo ‘LED Highbay‘;
    echo ‘
    ‘;
    echo ‘
  • ‘;
    } ?>

    Any assistance with this would be GREATLY appreciate. Thanks.

Viewing 1 post (of 1 total)

The topic ‘ACF, checkboxes and arrays.’ is closed to new replies.