Support

Account

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);
            }	
    }
    // ...