I have the following structure:
Custom Taxonomy Car Brands
- Ford
- Car x
- Car Y
- Car Z
- Audi
I want to list in the sidebar all ford cars registered. How can I do without a plugin?
I have the following structure:
Custom Taxonomy Car Brands
I want to list in the sidebar all ford cars registered. How can I do without a plugin?
Use get_term_by()
to search for Ford ID and wp_list_categories()
to list the child terms. If the taxonomy is not category
change in the example by the appropriate name:
<ul>
<?php
$parent = get_term_by( 'name', 'Ford', 'category' );
wp_list_categories( array(
'childof' => $parent->term_id,
'taxonomy' => 'category',
) );
?>
</ul>