Support

Account

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; ?>