Support

Account

Home Forums ACF PRO output value from checkbox field into table Reply To: output value from checkbox field into table

  • Well, if the output is set to array you can’t just do if($colours == 'blue'), you need to either loop through the array and print the results accordingly or you need to access the array items directly. How to do this is explained in the documentation. But apparently you don’t even need the array output, you could just output the value since you’re not doing anything with the labels.

    I guess for you the example under “Conditional logic” in the documentation would be appropriate:

    <td>
    <?php if($colours && in_array('yellow',$colours) { ?>
    YES
    <?php } ?>
    </td>
    <td>
    <?php if($colours && in_array('red',$colours) { ?>
    YES
    <?php } ?>
    </td>
    
    <td>
    <?php if($colours && in_array('blue',$colours) { ?>
    YES
    <?php } ?>
    </td>
    <td>
    <?php if($colours && in_array('green',$colours) { ?>
    YES
    <?php } ?>
    </td>

    (not tested)