Tabbed Tag Clouds for Posts

While I myself use tag clouds on WordPress installations mainly in the sidebar, several users have requested advice on how to use the Tag Groups plugin to display a tag cloud on posts (or pages) that would filter the tags or groups according to the tags of that particular post.

There are two cases that are now provided by the new version (0.10):

  1. The tag cloud displays only tags that are assigned to that particular post.
  2. The tag cloud displays only groups and their tags that contain tags of that particular post.

While the first case appears to be quite clear, it may not be obvious what to use the second case for.

Imagine your blog offers reviews of cafés, restaurants etc. Tag groups represent the different types – café, restaurant, bar etc.. Imagine now a review of the “Blue Café”, which has the tags “cappuccino” and “beer”. The tag “cappuccino” is assigned to the group “café” while “beer” is assigned to the group “bar”. The tag cloud on this post would therefore display the groups “café” and “bar”, and below all the tags assigned to these two groups, including “espresso” in “café” and “whiskey” in “bar”. Your readers can thus easily find similar posts and pick them by their group.

As a logical result, I also added the option to hide empty tabs (i.e. groups that have nothing to display). This option, however, makes only sense for the first case mentioned above (since the second already hides groups that are not relevant).

The new parameters are: tags_post_id, groups_post_id and hide_empty_tabs.

Let’s have an example: