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;?>
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.