Use get_terms()
with child_of
(accepts numerical ID of parent term) argument to retrieve child terms and then loop through them and on each iteration use current term in the loop.
Code example (not tested):
$child_terms = get_terms( array( 'child_of' => $cameras_term_id ) );
foreach( $child_terms as $term ) {
$args = array(
'post_type'=> 'rental_gear',
'type' => $term->term_slug,
'order' => 'ASC',
'posts_per_page' => '-1'
);
$the_query = new WP_Query( $args );
if($the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post();
?><li class="equip-li"><a href="https://wordpress.stackexchange.com/questions/69429/<?php the_permalink(); ?>">› <?php the_title(); ?></a></li>
<?php endwhile; endif; wp_reset_postdata(); ?>
}
Related Posts:
- How to get the parent’s taxonomy?
- Show Post Count of a Category
- Fetch taxonomies by custom post type id array
- Variable not working in WP_Query
- Get posts by category name
- WP_Query for custom taxonomies showing posts from non-specified terms?
- Custom Taxonomy – fields
- Displaying WordPress posts from post and custom post type in custom taxonomy
- How to display elements of different post types?
- How to get all taxonomies of a post type?
- Saving Taxonomy Terms
- Get Posts by Custom Post Type ,Taxonomy, and Term
- $wp_query->queried_object->ID throws warning: Undefined property
- How do I list custom taxonomy terms without the links?
- How to list custom taxonomy categories?
- Custom Taxonomy Template Post List with Sort Order
- The Operator “NOT IN” Does Not Work In tax_query
- wp_insert_term doesn’t work with custom post type’s taxonomy
- Taxonomy archives based on Custom Post Type
- How to get_queried_object on multiple objects?
- Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy
- Help with hierarchical custom taxonomies and permalinks…almost there
- custom post type paging not working past page 3
- wp_insert_post custom taxonomy
- Display taxonomy term only if there’s a value
- Get all taxonomies for all post types
- Optimised Code for Pulling Taxonomy Posts
- WP_Query search posts by custom post type and custom taxonomy
- Problem with custom post types, taxonomy and permalinks
- How to create new category for custom post type?
- get_terms showing all categories instead of the ones assigned to a specific post
- Why does querying on post_tags (which has been applied to custom post types) only return posts?
- How to show CPTs in term archive
- shortcode to show custom post types by category
- wp_set_object_terms() not adding new term to custom post and custom taxonomy
- Query/list all terms and their custom post count
- Genesis filterable portfolio isotope [closed]
- Get custom taxonomies from multiple posts
- Return one unique custom post type result when it shares a custom taxonomy in WP_QUERY?
- Categories of custom taxonomy don’t show any posts
- Is it possible to have dedicated page for parent/child taxonomy?
- WP_Query inside foreach loop returning same value for all options when filtered using ajax
- Display a grid of taxonomy terms at root taxonomy page
- How can I made custom taxonomies relationship?
- limit value taxonomy based on previous taxonomy value wordpress
- How to conditionally redirect to the post from a taxonomy page?
- First custom field value (out of several) displayed twice after query
- How to make custom taxonomy into drop down select in a custom metabox
- How to display products name in a non-alphabetical order, in a custom field (taxonomy)?
- Taxonomy in URL
- Why is my WP_Query outputting my entries twice?
- How to display Related Posts based on number of taxonomy terms matched
- How to Set Taxonomy Object Description?
- How to make WP_Query not to show irrelevant posts?
- Custom select query for taxonomies that have posts categorized in another taxonomy
- Create an archive page for custom post type with custom taxonomy
- WP_Query() with custom post type and taxonomy — get all terms?
- WP_query – Filter by tax_query and meta_query using multiple select
- Hide meta box for everything BUT a certain custom post type
- Wp Query with multiple custom tag(taxonomy) by get the terms
- Alphabetically sort a taxonomy.php template by post title
- Show Taxonomies with admin area for custom post type?
- How to sort a WP_Query by a custom field AND ALSO filter by a different custom field
- Custom taxonomy template list not working (404)
- Use the custom post type archive for taxonomies?
- Taxonomy template page not working
- How to count other posts not having specific taxonomy terms?
- Copy/Move selected taxonomy terms to another taxonomy for posts
- Running a custom query inside another cpt single and trying to grab a variable
- Query custom posts from custom taxonomy
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- set object terms after some some time of published post – functions.php
- Sort custom posts by date and then by taxonomy
- Display related CPT with custom taxonomy
- How can i display a taxonomy? i have created a plugin and then a custom type. and a taxonomy , also i have register it
- Define multiple prefixes for custom post type
- Taxonomies are not showing in the category dropdown
- Change custom post taxonomy values from front-end
- Display 3 level taxonomies
- How to transfer categories (default) to custom taxonomy?
- WP_query sort by taxonomy
- CPT Loop, include taxonomies and disclude others?
- Pages of my taxonomy terms are showing all posts
- If custom taxonomy exist on post?
- How to show post which has the specific taxonomy terms?
- WordPress add taxonomies/terms list as a menu in archive page
- Custom post type and custom taxonomies display
- How to create TEMPLATES for TAXONOMIES? What I have to change in this code?
- WordPress custom post type
- Custom Taxonomy Query by Taxonomny not working
- Displaying taxonomy icon outside archive page
- Show taxonomies from specific CPT
- insert a taxonomy for a custom post type
- WP Query Post Type with same Taxonomy name
- See the process of creating a taxonomy and tell me where I made a mistake
- How to add to taxonomies to a post type
- Filtering custom post types using category taxonomy
- Is it possible for post and custom post type to share a category base slug?
- Query custom post type and group by taxonomy
- How do I get parameters from the URL?