I have a custom post type (“products”) with an associated custom taxonomy (“product_type”). So when I create a product, I choose in which category it goes.
The taxonomy is hierarchical and it goes like this:
Category 1
Sub-Category 1.1
Sub-Category 1.2
Sub-Category 1.3
Category 2
Category 3
Sub-Category 3.1
Sub-Category 3.2
etc, etc
What I want (and don’t know how to do it) is to create a menu that dynamically replicate my taxonomies, with the products associated to them.
The rendered html should be something like this:
<ul>
<!--first level-->
<li>
<a href="#">Category 1</a>
<ul>
<!--second level-->
<li>
<a href="#">Sub-category 1.1</a>
<!--third level-->
<ul>
<li><a href="#">product</a></li>
<li><a href="#">product</a></li>
</ul>
</li>
<!--second level-->
<li>
<a href="#">Sub-category 1.2</a>
<!--third level-->
<ul>
<li><a href="#">Product</a></li>
<li><a href="#">Product</a></li>
</ul>
</li>
</ul>
</li>
<!--first level-->
<li class="first-level">
<a href="#">Category 2</a>
<ul>
<!--second level-->
<li><a href="#">Product</a></li>
<!--second level-->
<li><a href="#">Product</a></li>
<!--second level-->
<li><a href="#">Product</a></li>
</ul>
</li>
</ul>
I know html, but I'm not too savvy in php.
Can anybody point me in the right direction to accomplish that?
Thanks!