'Works for radio, not for checkbox. Whats wrong?
So this is all pretty new to me. Struggling my way through code and all posted here already. Can anyone tell me, why this basic code does show how many time a radiobutton is selected, but when I use it on a checkbox, it will not display how many times that checkbox is selected. Should do that right, also for checkboxes?
$args = array(
‘posts_per_page’ => -1, //get all posts
‘post_type’ => ‘project’, //posts, pages, whatever the field is attached to
‘meta_key’ => ‘project_status’, //custom field slug
‘meta_value’ => ‘Finished’ //location to count
);
// query
$the_query = new WP_Query( $args ); //get WP Query using $args
$count = $the_query->post_count; //use property post_count to return the count
echo ‘Finished: ‘. $count;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
