2020-03-25 16:08:25

Related Docs

Do You Need Help or Expertise?

Is editing Source Code not Your Thing? Are you in a tight Time Schedule and need to deliver a fully scalable and safe solution fast to your Clients?

Maybe you want to incorporate the Software found on TukuToi unbranded and royalty free in your Clients Projects after customizing it as per your Projects requirements?

Or eventually you need some training on any WordPress Plugin, Theme or their creation and maintenance?

ShortCodePost Count for multiple Taxonomies and Terms

ShortCode to output the total (count) of Posts with specific Taxonomy Terms set.

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' );