Just check the total number of posts found:
if($your_query->found_posts > 20) ...
and decide how do you want your mark-up to be.
If want to see how many products are associated with a certain product_category term, use get_term() and check out the ‘count’ property
Related Posts:
- Display all posts in a custom post type, grouped by a custom taxonomy
- query multiple taxonomies
- Sort the main query in subcategories/terms?
- Should unaltered default loop/query return a list of custom posts belonging to a custom taxonomy?
- Query for posts in 2 taxonomies
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- wp_query to find posts by year and month
- Custom Post Type Loop within Shortcode
- Filter by custom taxonomy slug on a custom post type
- Display CPT posts based on specific taxonomy
- Filtering WP_Query Dynamically on the Front-End
- Custom loop with multiple taxonomy queries
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- What’s the WP way to load remaining custom posts?
- Display Custom Taxonomy Alphabetically
- Listing all term items alphabetically / sorting loop
- display posts of custom post type with custom taxonomy
- List all Custom Post Type posts excluding certain Taxnomy term
- Cant’ Display Custom Post Type Title Base on Tax Terms
- Loop for custom-post-type comparing taxonomy terms for “related” posts?
- Multiple custom post type queries causing wrong post types to be grabbed in taxonomy + single templates?
- What is the most efficient way to execute recursive complex queries?
- display post count in archive page that have relation with another taxonomy term
- Excluded Custom Taxonomy Term Posts Displaying in loop
- posts_per_page is not working by term
- Display title of all custom posts from same taxonomy term on a custom post template
- Add active class to foundation 6 tabs while looping categories
- How to show terms used only for particular custom post type. Filter creation perpose
- Display all Custom taxonomy terms and their relevant custom posts
- Get posts of an specific term of a custom taxonomy
- How to pass taxonomy terms to WP_Query along with $args?
- Loop with Custom Post Type and Taxonomies
- Post data in separate divs with incrementing class using WP_Query
- Catergory args causing loop not to show
- How to Get The Taxonomy Term in Custom Post Type Loop Inside a Wp Query
- display custom post type from register taxonomy
- Complex Custom Loop with Includes
- Loop through Custom Post Type, and then show children within each iteration
- Does WordPress limit the length of slug names for Post Meta or Terms?
- Only show posts from a certain category?
- Very Slow Page – How to Optimize # of Queries?
- Pagination : How to remove /page/x/ after a ‘POST’ action on a form returning to page 1
- Can I create a loop with multiple post types and specify different $args for each post type?
- get_post_meta returns empty array for terms
- Show listings from Impress Listing plugin in random order using taxonomy and terms
- shortcode to show custom post types by category
- WordPress Genesis custom taxonomy archive shows 3 repeats of each post
- WP_Query orderby modified to include custom meta changes
- Update post terms with custom taxonomy
- How do I display tags for a custom post type single page?
- Am unable to reset a query properly
- Query/list all terms and their custom post count
- Custom Post Type Archive Page Filtering
- get_attached_media() on author page not working
- How to make sure content doesn’t display if selection is empty
- Show one item per category of a custom post type
- Why get_posts() not returning only selected category posts from Custom Post Type?
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- Get template part using a custom taxonomy term
- Archive for custom taxonomy lists all posts instead of current taxonomy
- Genesis filterable portfolio isotope [closed]
- Get posts by querying taxonomy and certain terms of the taxonomy?
- How to restrict users and admin from creating new taxonomy terms?
- Get next and previous 3 posts in a term in single post page
- wp_query check if integer exists in custom field’s array
- Wrong request query on cpt and tax
- Loop custom taxonomy to get lists of cutom post types?
- Get custom taxonomies from multiple posts
- Pagination for Custom Taxonomy Page [duplicate]
- Search / Filter posts on Title/Content OR Tags
- using $wpdb to get custom post type with term
- WP_Query most viewed posts, in multiple Post Types, last 30 days, excluding a specific taxonomy term
- Show posts from two or more custom taxonomy terms
- Allow user to set custom order to a list of custom taxonomies?
- Custom-Posttype & Custom Taxonomy WP_Query
- Return one unique custom post type result when it shares a custom taxonomy in WP_QUERY?
- Displaying custom taxonomy in the admin list of a custom post type
- Which post does a taxonomy term belongs to?
- Custom post type multiple loop by taxonomy term
- List custom taxonomy specific to one custom post type
- Show a Category X’s custom post type on Category X archive page?
- Display post as term id
- Display all taxonomy terms, add class if term applies to current post
- Return the latest post from a custom Taxonomy and Post Type
- Custom taxonomy rewrite give pagination 404
- Displaying CPT and custom taxonomy side by side in Bootstrap 4 component
- How do I display the taxonomy term alongside the post type post title?
- WP_Query inside foreach loop returning same value for all options when filtered using ajax
- Custom post taxonomies as tax_query terms?
- Group CPT posts by custom taxonomy
- Issue on Creating Custom Tax Term Dynamically From Another CPT Meta-box On Publish
- Post count by month of taxonmy term
- Custom WP Query on custom meta and sort by multiple meta keys value
- How can I made custom taxonomies relationship?
- Custom taxonomies relationship
- WP Query with categories only shows one post and ignores the category
- How do I display the taxonomy for a custom post type in an array
- Full Custom Post Type List Organised by two Taxonomies
- How to have this permalink structure: post_type/postname/custom_inner_page
- Problem: wp_query outputs all images on site