Display only assigned tags of custom taxonomies in archive
-
Since wp 3.0 it is possible to display all tags of a specific custom taxonomy using the wp_list_categories(‘taxonomy=my_taxonomy’) – template tag. This works just fine.
What I am wondering about is if it is possible to display not just all the tags which are used in all of your posts but only those which are used in a specific archive listing.
I try to make it clear by giving an example:
Lets say I got two custom taxonomies for my posts. The first is for instance ‘length’ with the tags ‘long’, ‘medium’ and ‘short’; the second is ‘relevance’ with the tags ‘high’, ‘little’ and ‘no’. In each post both taxonomies are added. So one post is tagged ‘long‘ and ‘no‘, another ‘medium’ and ‘high’ and so on.
Using the wp_list_categories-template tag for both taxonomies on the wp-theme will bring up a list of all the used tags from all the posts. This is fine on the indexpage where all posts are listed. But when it comes that I switch to an archive page (f.i. ‘?length=long’) I would like the listing to be modified that only those tags show up which are assigned to those posts listed in this specific archive.
Lets say I’m in the archive ‘?length=long’ and none of the listed posts is tagged with ‘relevance=high’. If this is the case the tag ‘high’ is supposed to disappear from the wp_list_categories(‘taxonomy=relevance’)-generated list.I guess this thing could be done by changing the query the wp_list_categories-templatetag is doing from global posts to the current query string. As far as I know there is no parameter for setting the querysource in the templatetag. Any ideas would be great. Thanks!
- The topic ‘Display only assigned tags of custom taxonomies in archive’ is closed to new replies.