Home › Forums › ACF PRO › Checkbox values not allowing conditional display › Reply To: Checkbox values not allowing conditional display
not sure if I am looking at this wrong, but from what I see in the code, the dump of $currency shouldn’t be an array
this bit here
<?php
if(have_rows('currencies', 'option')): while(have_rows('currencies', 'option')): the_row();
$currency = get_sub_field('currency');
endwhile; else : endif;
?>
This would overwrite the value of $currency with each iteration, try changing it to
<?php
$currency = array();
if(have_rows('currencies', 'option')): while(have_rows('currencies', 'option')): the_row();
$currency[] = get_sub_field('currency');
endwhile; else : endif;
?>
and because currency is defined, you can eliminate the if($currency) and just use the in_array()
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.