Tag cloud highlighting

<?php

function wco_current_term_highlight($cloud){
if(!is_tax('wco_category')) return $cloud;
$wco_categories = get_terms('wco_category');
if($wco_categories === false) return $cloud;
foreach($wco_categories as $category) if(is_tax('wco_category',$category->slug)) $cloud = str_replace("tag-link-$category->term_id", "current-term tag-link-$category->term_id",$cloud);
return $cloud;
}
add_filter('wp_tag_cloud','wco_current_term_highlight');

?>

0 Comments

You must be logged in to post a comment.