Support

Account

Home Forums ACF PRO Show icon if checkbox is checked Reply To: Show icon if checkbox is checked

  • With return value, I’ve tried the 3 options:

    1. Value
    This works and display the label correctly ONLY if I have removed the VALUE ‘pet’ from pet: Pet Friendly in Choices.

    2. Label
    This works and display the label correctly ONLY if I have removed the VALUE ‘pet’ from pet: Pet Friendly in Choices.

    If i leave the ‘pet’ in i.e. pet: Pet Friendly
    I get Notice: Undefined index: Pet Friendly in

    3. Array (both)
    Error on every facility
    Warning: Illegal offset type in

    It appears I need to use the Array option so it can collect both the value and the label.

    If that’s the case, I’ll need to redo the code to display all the Facilities…
    which is currently:

    <?php 
    $field = get_field_object('hh_facilities');
    $value = $field['value'];
    $choices = $field['choices'];
    
    if( $value ): ?>
    <ul>
    	<?php foreach( $value as $v ): ?>
    	<li>
    		<?php echo $choices[ $v ]; ?>
    	</li>
    	<?php endforeach; ?>
    </ul>
    <?php endif; ?>