How to use "if then" with ACF checkbox array
-
I have an Advanced Custom Fields checkbox. When an option is checked, I want to show an image on the theme page. For example, if someone checks “hat” I want to show an icon of a ball cap.
I know how to just print out the array:
<?php $values = get_field('services_offered'); if($values) { echo '<ul>'; foreach($values as $value) { echo '<li>' . $value . '</li>'; } echo '</ul>'; } ?>
But I need it to do the “if this box is checked” then “do this” type stuff for the check boxes.
I also know how to do a normal PHP if statement for a single ACF field. But this checkbox array is killing me.
Thanks for any help!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to use "if then" with ACF checkbox array’ is closed to new replies.