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?
- shortcode to show custom post types by category
- wp_set_object_terms() not adding new term to custom post and custom taxonomy
- Display all posts in main category and 1 subcategory
- Query/list all terms and their custom post count
- Filtering WP_Query Dynamically on the Front-End
- wp_get_post_terms on custom post type with custom taxonomies returning an empty array
- Why get_posts() not returning only selected category posts from Custom Post Type?
- Archive for custom taxonomy lists all posts instead of current taxonomy
- Genesis filterable portfolio isotope [closed]
- wp_query check if integer exists in custom field’s array
- Wrong request query on cpt and tax
- Custom Taxonomies not appearing in Admin
- Get custom taxonomies from multiple posts
- Pagination for Custom Taxonomy Page [duplicate]
- Search / Filter posts on Title/Content OR Tags
- Custom Post Type Taxonomy Filters
- WP_Query most viewed posts, in multiple Post Types, last 30 days, excluding a specific taxonomy term
- Custom-Posttype & Custom Taxonomy WP_Query
- Custom loop with multiple taxonomy queries
- 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
- How to display custom taxonomies with links in filter menu?
- Custom Taxonomy back-end customizations
- Taxonomy custom post type URL
- How to Filter custom post type by taxonomy?
- Custom taxonomy rewrite give pagination 404
- Is it possible to have dedicated page for parent/child taxonomy?
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- WP_Query inside foreach loop returning same value for all options when filtered using ajax
- Custom post taxonomies as tax_query terms?
- Get related posts of child term of custom post type
- Limit amount of posts made within a custom taxonomy
- Issue on Creating Custom Tax Term Dynamically From Another CPT Meta-box On Publish
- Custom WP Query on custom meta and sort by multiple meta keys value
- list taxonomies from a custom post type
- Display a grid of taxonomy terms at root taxonomy page
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- How can I made custom taxonomies relationship?
- What’s the WP way to load remaining custom posts?
- limit value taxonomy based on previous taxonomy value wordpress
- Custom taxonomies relationship
- Several post types on WP Query by tag and taxonomy
- How do I display the taxonomy for a custom post type in an array
- How to conditionally redirect to the post from a taxonomy page?
- How do I check if the user is on a taxonomy term parent, child or grandchild page?
- How do I display the grand child items of a taxonomy term?
- Taxonomies relations
- Is it better to use WordPress Custom Post Types or Taxonomies?
- Full Custom Post Type List Organised by two Taxonomies
- WordPress Doesn’t Generate Taxonomy Archive
- How to have this permalink structure: post_type/postname/custom_inner_page
- Suggested Post and Taxonomy structure
- Query Custom Post Type Taxonomy term with multiple parameters
- First custom field value (out of several) displayed twice after query
- Custom post with more than one custom taxonomy
- Get the taxonomy of a post hierarchically
- Adding custom taxonomy in same menu place with two custom post types
- How to make custom taxonomy into drop down select in a custom metabox
- Add Custom Post Type of specific Custom Taxonomy to regularly blog loop
- How to get list of taxonomy slugs ordered parents>childs?
- WP_Query orderby and tax_query
- How do I share categories across multiple post types?
- Multiple tag cloud filtering
- Get url.com/post_type/taxonomy/term work!
- How to display products name in a non-alphabetical order, in a custom field (taxonomy)?
- Taxonomy in URL
- Advanced search form with filters for custom taxonomies
- Why is my WP_Query outputting my entries twice?
- How to display Related Posts based on number of taxonomy terms matched
- Different Category system needed for the Custom Post Type
- Custom Post Type Category Link
- Retrieve custom post types by custom taxonomies with WP_Query
- Custom Post type category pages template and loop
- WP the_posts() on single-cars.php get category link
- tax_query not working in template
- Custom Taxonomy Not Showing in Front-End When Outputting a Custom Post Type with WP_Query()
- 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
- Custom Taxonomy Is Being Pulled into a Page, But It Doesn’t Have A Hyperlink
- Querying two taxonomies with tax_query not woking
- Rename a slug label
- WordPress wp_query() basic question about args
- Create an archive page for custom post type with custom taxonomy
- Hide specific taxonomies from a taxonomy list using ‘get_object_taxonomies’
- Using page slug in wp_query
- WP_Query() with custom post type and taxonomy — get all terms?
- Custom taxonomy (categories) on custom post type return no results
- Custom taxonomy wp_query woes.
- WP_query – Filter by tax_query and meta_query using multiple select
- Hide meta box for everything BUT a certain custom post type