Created
April 10, 2012 13:30
-
-
Save diegogangl/2351388 to your computer and use it in GitHub Desktop.
[Wordpress 3.3] I've found that wp_list_categories doesn't highlight the current category if it's a taxonomy term (and you're in a taxonomy archive), this little snippet fixes that.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Get the term id first | |
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); | |
$currentTerm = $term->term_taxonomy_id; | |
// This is how you'd use it in your template | |
wp_list_categories( array( | |
'taxonomy' => 'YOUR_TAXONOMY', | |
'current_category' => ( isset($currentTerm) ) ? $currentTerm : null | |
)); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment