Home › Forums › General Issues › Checkbox while loop if value exists › Reply To: Checkbox while loop if value exists
Thanks for the reply @elliot, however, adding the endif; doesn’t solve it. It still is spitting out the word ‘test’ infinitely and crashing the site, rather than what is to be expected.
<?php $courses = get_posts(array(
'meta_query' => array(
array(
'key' => 'short_course', // name of custom field
'value' => '"yes"', // matches exaclty "yes", not just yes. This prevents a match for "acquired"
'compare' => 'LIKE'
)
)
));
if ( $courses ) : while ( $courses ) : ?>
test
<?php endwhile; 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.