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 25, 2018.

  1. scottiescotsman


    Reply To: count custom taxonomy, by scottiescotsman



    foreach ( get_terms( array(
    'taxonomy' => 'actor',
    ) ) as $cat) :
    <div class="col-md-4">
    <?php $the_query = new WP_Query( array(
    'post_type' => 'movies',
    'tax_query' => array(
    'taxonomy' => 'actor',
    'field' => 'term_id',
    'terms' => $cat->term_id,
    ) );
    $count = $the_query->found_posts; ?>

    <?php echo $cat->name; ?> <span style="color: white"><?php echo $count; ?></span>


    <?php endforeach; ?>

    Reply To: count custom taxonomy

Share This Page

Monarch Social Sharing Plugin