That title is a mouthful, but that's what I'm attempting to do. I discovered a neat trick to add elements via <span>, <div>, or otherwise in the code for each category listing here. Now the new challenge is to make this category
function show_active_category($text) {
global $post;
if( is_single() || is_category() ) {
$categories = wp_get_post_categories($post->ID);
foreach( $categories as $catid ) {
$cat = get_category($catid);
if(preg_match('#>' . $cat->name . '</a>#', $text)) {
$text = str_replace('>' . $cat->name . '</a>', ' class="active-cat">' . $cat->name . '</a>', $text);
}
}
}
return $text;
}
add_filter('wp_list_categories', 'show_active_category');
This plugin works great alone, but I'm trying to combine the two. I tried canging variable names so there's no conflict. I even changed the add_filter('wp_list_categories... to add_filter('get_categories... but that didn't work either.
Any help would be much appreciated.
thanks!