Divi WordPress Theme
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix Reply To: count custom taxonomy

Discussion in 'Misc WordPress Requests' started by scottiescotsman, Feb 23, 2018.

  1. scottiescotsman

    Guest

    Reply To: count custom taxonomy, by scottiescotsman

    <?php foreach (get_terms('actor') as $cat) : ?>

    <div class="col-md-4">

    <?php $args = array(
    'post_type' => 'movies',
    'tax_query' => array(
    array(
    'taxonomy' => 'actors',
    'field' => 'slug',
    'terms' => array( $cat ),
    ),
    ),
    );
    $query = new WP_Query( $args );

    $count = $query->found_posts;

    ?>

    <?php echo $cat; ?>

    </div>

    <?php endforeach; ?>

    Reply To: count custom taxonomy
     
    #1

Share This Page

Monarch Social Sharing Plugin