I search all the web for that answer. I use wp_list_categories to make a submenu with custom taxonomy, It works well, and puts current-cat when I browse those categories.
The thing is, when I browse single posts with this menu, the highlight no more works.
For the blog part of that site, I use the following code to highlight current category on wp_list_categories():
function sgr_show_current_cat_on_single($output) {
global $post;
if( is_single() ) {
$categories = wp_get_post_categories($post->ID);
foreach( $categories as $catid ) {
$cat = get_category($catid);
if(preg_match('#cat-item-' . $cat->cat_ID . '#', $output)) {
$output = str_replace('cat-item-'.$cat->cat_ID, 'cat-item-'.$cat->cat_ID . ' current-cat', $output);
}
}
}
return $output;
}
add_filter('wp_list_categories', 'sgr_show_current_cat_on_single');
But as far as I tried, can't make it work for single posts that are ordered by custom taxonomy. :/ > I don't know how to custom it.
Is it even possible ?