Home › Forums › Front-end Issues › Checking whether a checkbox is checked › Reply To: Checking whether a checkbox is checked
Change the_sub_field()
method and use get_sub_field()
instead. the_sub_field()
method will display the value whereas get_sub_field()
method will get the value. Change your code to the following:
if( in_array( 'car', get_sub_field('tyres_available') ) ) {
echo 'some html';
}
Check out the docs for more information: http://www.advancedcustomfields.com/resources/get_sub_field/
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.