My tagcloud are placed in the sidebar (outside the loop).
I want to give the tags in the tagcloud a class if the current post is tagged with the tag. How do I do this? - something id wrong :(
This is my PHP-code:
$tags = get_tags();
$post_tags = get_the_tags($currentid);
if ($tags) {
foreach ($tags as $tag) {
if( (is_tag($tag)) || ($tag->name == $post_tags) ){
echo '<a href="'.get_tag_link($tag->term_id).'" title="'.$tag->name.'" class="currenttag">'.$tag->name.'</a> ';
} else {
echo '<a href="'.get_tag_link($tag->term_id).'" title="'.$tag->name.'"">'.$tag->name.'</a> ';
}
}
}