1
I have the following structure:
Custom Taxonomy Car Brands
- Ford
- Car x
- Carro Y
- Car Z
- Audi
I want to list on sidebar all cars from ford registered. How can I do without plugin?
1
I have the following structure:
Custom Taxonomy Car Brands
I want to list on sidebar all cars from ford registered. How can I do without plugin?
1
Use the function get_term_by()
to retrieve Ford’s ID and wp_list_categories()
to list child terms. If 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>
Browser other questions tagged wordpress
You are not signed in. Login or sign up in order to post.