1
I am currently with a site project, and I have a list of Wordpress taxonomies, so:
-- Engines (parent)
--- Single Phase Motors (son)
--- Three Phase Engines (son)
I wanted to know how to create an HTML list in the Style:
- Electric Motors
- Motor Monophasic
- Three-phase Motor
My Code is currently taking all taxonomies and creating a direct list without Subcategories:
<ul>
<?php
$terms = get_terms(array(
'taxonomy' =>'categoria',
'hide_empty' => false
));
foreach($terms as $term){ ?>
<li>
<div class="menu-link"><a href="?taxonomy=<?= $term -> slug ?>"><?= $term -> name ?> </a><i class="fa fa-chevron-right" aria-hidden="true"></i></div>
</li>
<?php
}
?>
</ul>
I wanted to get the subcategories through the parent category.