Related Docs

Did not find what you're looking for? Search the complete TukuToi Software Documentation


Post Count for multiple Taxonomies and Terms

This WordPress ShortCode will allow to output the amount as the number of posts tagged with specific terms of specific taxonomies

Define the Post Type to query by Taxonomies and Terms in the code below and insert to the functions.php file of your Theme.

Then use it like so [count-posts-by-terms]

function count_posts_by_terms() { 
  $args = array( 
    'post_type' => 'vendor', 
    'numberposts' => -1, 
    'tax_query' => array( 
      'relation' => 'AND', array(
          'taxonomy' => 'area', 
          'field' => 'slug', 
          'terms' => array( 
        ), array( 
        'taxonomy' => 'entertainer', 
        'field' => 'slug', 
        'terms' => array( 
        'operator' => 'IN',
  return $num = count( get_posts( $args ) ); 

add_shortcode( 'count-posts-by-terms', 'count_posts_by_terms' );