I have a function that queries the children of each taxonomy terms, I'd also like to query the children of these children terms too, my markup is as follows:
<?php
$terms = get_terms("wpsc_product_category");
if ( !empty( $terms ) && !is_wp_error( $terms ) ){
foreach( get_terms( 'wpsc_product_category', array( 'hide_empty' => false, 'parent' => 0 ) ) as $parent_term ) { ?>
<div id="sub-header-menu-<?php echo $parent_term->slug; ?>" class="sub-header-menu-content">
<ul class="sub-header-menu">
<?php foreach( get_terms( 'wpsc_product_category', array( 'hide_empty' => false, 'parent' => $parent_term->term_id ) ) as $child_term ) { ?>
<li data-hook="<?php echo $child_term->slug; ?>">
<a href="<?php echo home_url(); ?>/products/<?php echo $child_term->slug; ?>"><?php echo $child_term->name; ?></a>
</li>
<?php } ?>
</ul>
</div>
<?php }
} ?>
Is this possible? Any suggestions would be greatly appreciated!
Aucun commentaire:
Enregistrer un commentaire