For a while I've been wanting to display the tags on a post only if there are more than 1 posts with that tag, and showing the total number of posts with that tag. The idea is to encourage site navigation by linking similar posts with tags, and not making people click on a tag only to find no other posts.
So the result would look like this:
View more posts tagged with: Elephants (3), Rabbits (1)
I have thrashed out the following code, which works. It is quite possibly not the most elegant solution so if you can improve it feel free I'm still using 3.5.1 so I just include this in Style & Edit Center Column > The Loop, underneath the post byline.
Code:
<?php $tags = get_the_tags(); if (is_array($tags)) { foreach ($tags as $tag) { if($tag->count > 1) $tagstart = 'Read more posts tagged with: '; $tag_link = get_tag_link( $tag->term_id ); if($tag->count > 1) $tagstring .= "<a href='{$tag_link}'>" . $tag->name . ' (' . $tag->count . ')' . "</a>" . ', ' ; }; $tagdisp = $tagstart . $tagstring; echo rtrim($tagdisp, ', '); } ;?>