Adding class “current_page_item” for custom post type category list(note: the category is belong in custom taxonomy)

I have this code:

<?php
  //list terms in a given taxonomy (useful as a widget for twentyten)
  $taxonomy = 'advice-cat';
  $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>

it display the list of category with permalink. so I want if I click one of the category in the list the list I click must highlight so visitors identify that they are in that specific category.

Related posts

Leave a Reply

1 comment