Support

Account

Home Forums General Issues Multiple conditional checkbox values not displaying data Reply To: Multiple conditional checkbox values not displaying data

  • You need to do the more specific check first.

    Your first check is true if the 3rd one is true. Since the 1st one is true you will never get to the 3rd one.

    
    <?php $options = get_field('options');?>
    <?php if( $options && in_array('option-1', $options) && in_array('option-2', $options ) ): ?>
      <p>Option 1</p>
    <?php elseif ( $options && in_array('option-2', $options) ): ?>
      <p>Option 2</p>
    <?php elseif ( $options && in_array('option-1', $options) ): ?>
      <p>Option 1 and Option 2</p>
    <?php endif;?>