Examples of Applications

On this page you find some examples of using the Tag Group plugin. These are mainly functions that I collected from the support forum. You may also send me your own code, but I won’t be able to set up the environment for each case to test it.

I hope that this will be helpful for people who have a particular requirement and need some inspiration on how to tackle the problem.

1. Filter posts on category pages

If you want to add an additional filter to your category pages and display only posts with tags that are members of particular tag groups, add the following code into the function.php of your active theme. You will need to pre-define your choice for each combination of category id => tag group id. If you display a page that is not in the array or if you choose a tag group that contains no tags, then posts will not be filtered.

2. Display a different tag cloud on each category page.

Add this into your theme’s category page (could be archive.php or category.php or others) to add a tag cloud of a particular tag group that can be pre-defined per category. The pattern in the array $term_group is category id => tag group id.

3. Display tag cloud on tag page for given group

Add this to your tag (or category, term ..) page (often this is archive.php) to display a tag cloud for the tag group that the displayed tag is a member of.

4. Same styling for all tags of same group

Add the following style sheet (e.g. into style.css) and refresh the cache. This will style the tags in the tag cloud, all tags of the first group red and all of the second group green.

5. Custom permalink bases for tags

Since the plugin doesn’t offer (yet) to automatically change tag bases according to the groups of the respective tags, you may want to try instead the Custom Permalinks plugin. (many thanks to Wolf Larsen for the hint!)

6. Group name on top of tag page

Insert the following code into the template (usually tag.php):

7. Display tags in columns

This will produce for this blog:

English Czech German Burmese

8. Display tags in columns, responsive version

Experiment with the min-width values to find what suits your website.

Output: (try to change the window size)

9. Use Tag Groups with a 3d-cloud

This can be achieved by modifying the plugin html5 Tag Cloud (Link seems to be broken. Try here). In that plugin you edit the file tagCloud-html5.php and replace the function wp_tag_cloud() by echo tag_groups_cloud(…). Inside the brackets you use the parameters for Tag Groups.

Leave a Reply

Your email address will not be published. Required fields are marked *

*