Home › Forums › ACF PRO › Show icon if checkbox is checked › Reply To: Show icon if checkbox is checked
If you are returning the value then this should be correct
<?php $pets = get_field_object('hh_facilities');
if( in_array('pet', $pets) ): ?><i title="Pet Friendly" class="fa fa-paw" aria-hidden="true"></i><?php endif; ?>
If you’re returning the label then this would be what you’d use
<?php $pets = get_field_object('hh_facilities');
if( in_array('Pet Friendly', $pets) ): ?><i title="Pet Friendly" class="fa fa-paw" aria-hidden="true"></i><?php endif; ?>
if you’re returning an array
<?php $pets = get_field_object('hh_facilities');
if( isset($pets['pet']) ): ?><i title="Pet Friendly" class="fa fa-paw" aria-hidden="true"></i><?php endif; ?>
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!
🚀 ACF & ACF PRO 6.0.7 are now available.
— Advanced Custom Fields (@wp_acf) January 18, 2023
✨This release contains bug fixes and improvements while we continue to work on the next major release of ACF.https://t.co/wQgAOpwmUI
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.