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)
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.