I am using the following snippet in order to list the terms of a custom taxonomy term I've created called "type".
<?php
$taxonomy = 'type';
$tax_terms = get_terms($taxonomy);
?>
<ul>
<?php
foreach ($tax_terms as $tax_term) {
echo '<li>' . '<a href="' . esc_attr(get_term_link($tax_term, $taxonomy)) . '" title="' . sprintf( __( "View all posts in %s" ), $tax_term->name ) . '" ' . '>' . $tax_term->name.'</a></li>';
}
?>
</ul>
The code list all the terms and if I click one of the terms, I get to the archives page, which is great. The thing is that I've noticed that there is no "active" trail class in the active term Wordpress is displaying the info.
So if I am at the restaurant terms page, the related li doesn't show as active.
<ul>
<li><a href="http://example.com/stores/type/pharmacies/" >Pharmacies</a></li>
<li><a href="http://example.com/stores/type/restaurants/">Restaurants</a></li>
</ul>
Any idea on how I could add this class (for CSS styling purposes).
Thanks a lot for your help.