Home › Forums › General Issues › Count posts by checked value (checkbox) › Reply To: Count posts by checked value (checkbox)
So you want to count posts that have a field named ‘aangeboden_door’ with several different values? I think you’ll have to modify the function so as to add meta_value as an array (of values) and setting ‘compare’ => ‘IN’. Try something like this:
// ...
if ( $meta_key && $meta_value ) {
if ( is_array($meta_value) ) {
$args['meta_query'][] = array('key' => $meta_key, 'value' => $meta_value, 'compare' => 'IN');
}
else {
$args['meta_query'][] = array('key' => $meta_key, 'value' => $meta_value);
}
}
// ...
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.