I'm looking to determine if a taxonomy term has children. See the below markup and I'll explain what I mean:
<?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 ) { ?>
<li class="header-menu-item" data-hook="<?php echo $parent_term->slug; ?>">
<a href="<?php echo home_url(); ?>/products/<?php echo $parent_term->slug; ?>"><?php echo $parent_term->name; ?></a>
</li>
<?php }
} ?>
So this outputs a list of all parent taxonomy terms for the wpsc_product_category
taxonomy, but I want to determine if the taxonomy term has children or not, and if so add the parent
class to the relevant header-menu-item
so I can attach a jquery function to it. I'm not sure if this is possible? Any suggestions would be greatly appreciated!