get_the_tags
will return an object of tags so you will have to make an array of the post tags and then see if the $tag->name
is in the post tags array.
$tags = get_tags();
$post_tags = get_the_tags($post->ID);
/* Just make an array so you can use in_array function later on */
$post_tag_array = array();
foreach( $post_tags as $post_tag ){
array_push($post_tag_array,$post_tag->name);
}
if ($tags) {
foreach ($tags as $tag) {
/* Then change to search this array for the $tag->name */
if( (is_tag($tag)) || ( in_array($tag->name, $post_tag_array )) ){
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> ';
}
}
}
Hope this helps