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
- How do you get the count of posts in an archive page?
- Display current taxonomy term when inside custom post type
- Get term slug of current post
- $wp_query->queried_object->ID throws warning: Undefined property
- How do I list custom taxonomy terms without the links?
- The Operator “NOT IN” Does Not Work In tax_query
- wp_insert_term doesn’t work with custom post type’s taxonomy
- How to get_queried_object on multiple objects?
- How to get the parent’s taxonomy?
- Using new WP_Query in shortcode in a custom field causes the main post content to not display
- Taxonomy posts on Archive page
- Help with hierarchical custom taxonomies and permalinks…almost there
- Optimised Code for Pulling Taxonomy Posts
- How to output wordpress custom tags separated by comma?
- Remove duplicated values from a loop
- Fetch taxonomies by custom post type id array
- How to connect two custom post types with nested loops
- Normal pages as children of my Custom Post Type
- Does WordPress limit the length of slug names for Post Meta or Terms?
- shortcode to show custom post types by category
- Query/list all terms and their custom post count
- Genesis filterable portfolio isotope [closed]
- Get custom taxonomies from multiple posts
- Displaying CPT and custom taxonomy side by side in Bootstrap 4 component
- WP_Query inside foreach loop returning same value for all options when filtered using ajax
- Group CPT posts by custom taxonomy
- WordPress query with items from more than one selfdefined taxonomy as `term` argument
- Display related custom taxonomy posts in sidebar
- Why is my WP_Query outputting my entries twice?
- How to display Related Posts based on number of taxonomy terms matched
- Targeting custom post type
- Using wp_query to modify the loop in index.php for a CPT
- Custom WP_Query doesn’t display all posts
- WP_Query() with custom post type and taxonomy — get all terms?
- Query & the_content() is showing in the header
- Variable not working in WP_Query
- Wp Query with multiple custom tag(taxonomy) by get the terms
- looping though custom post types and only return results in a given taxonomy
- Pagination not working on custom query on a page
- Get taxonomy term by slug in post on archive page
- get_terms() parent, child and grandchild
- Retrieve Custom Taxonomies with Description and Slug
- How to list posts by term (custom taxonomy)
- Query custom posts from custom taxonomy
- Pin posts to top of custom loop
- How to display custom taxonomy term specific post?
- How to associate custom taxonomy terms with custom post type?
- get_queried_object not work in taxonomy page
- get_the_terms child terms for current post/custom post only
- Custom Taxonomy – fields
- CPT Loop, include taxonomies and disclude others?
- How to get all posts related to a taxonomy?
- Custom taxonomy- only output relevant terms
- Custom post types not displaying per category
- Custom Post Status & Taxonomies
- WordPress custom post type
- Prevent repetitive terms in get_the_term_list
- Custom loop won’t work, can’t find problem
- Loop through multiple custom taxonomy terms and display posts for a custom post type
- How to exclude certain portfolios from a loop
- How to manage a bookstore
- How can I show posts with the same tag?
- WP Query – Can’t get posts with specific taxonomy