计算选择值的总次数

A custom post type has the following drop down menu options to list homes for sale as viewable, being built, sold, or proposed build. Is it possible to count the total number of homes in each of the categories and publish it on the site? For example "there are X houses being built". Where X is the total homes with the status being built.

<select name="listing_status_dropdown"><?php
        $status_options = array('Viewable', 'Being Built', 'Sold', 'Proposed Build');
        foreach ($status_options as $the_status) { ?>
          <option value="<?php echo $the_status; ?>" <?php echo selected( $the_status, $listing_status_dropdown ); ?>>
          <?php echo $the_status; } ?>
      </select>

You can do custom queries for each of these meta values, and then count the number of posts that are returned using the $found_posts property of WP_Query. For example:

$args = array(
    'posts_per_page' => -1,
    'meta_key' => 'listing_status_dropdown',
    'meta_value' => 'Viewable'
);
$viewable = new WP_Query( $args );

// Display the number of 'Viewable' entries
echo $viewable->found_posts;