<ul>
<?php $hiterms = get_terms("prod_cat", array("orderby" => "count", "parent" => 0, "hide_empty" => 0)); ?>
<?php foreach($hiterms as $key => $hiterm) : ?>
<li>
<?php echo $hiterm->name; ?>
<?php $loterms = get_terms("prod_cat", array("orderby" => "slug", "parent" => $hiterm->term_id, "hide_empty" => 0)); ?>
<?php if($loterms) : ?>
<ul>
<?php foreach($loterms as $key => $loterm) : ?>
<li> - <?php echo $loterm->name; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<?php $hiterms = get_terms("prod_cat", array("orderby" => "count", "parent" => 0, "hide_empty" => 0)); ?>
<?php foreach($hiterms as $key => $hiterm) : ?>
<li>
<?php echo $hiterm->name; ?>
<?php $loterms = get_terms("prod_cat", array("orderby" => "slug", "parent" => $hiterm->term_id, "hide_empty" => 0)); ?>
<?php if($loterms) : ?>
<ul>
<?php foreach($loterms as $key => $loterm) : ?>
<li> - <?php echo $loterm->name; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
No comments:
Post a Comment