Wordpress plugins
TDO Tag Fixes

TDO Tag Fixes

Version : 0.5
Tested up to : 2.5.1
Number of download : 7583
Average rating : 5 / 5 on 1 votes 1 votes, 5 avg.rating

Screenshots

TDO Tag Fixes
TDO Tag Fixes
TDO Tag Fixes
TDO Tag Fixes

This plugin is simply intended as an example of how to implement tag and category intersections. However it has got a bit more feature-heavy recently. Please feel free to re-use the code in your plugin. This plugin is based on information found here. Version 0.5 enables true ‘or’ tag intersection when using a category. It wasn’t working prior to this (and no-one noticed). Thanks to Joel Giddey for spotting it. WordPress 2.3 introduced native tagging support, which is rather nifty. But did you know that you can display multiple tags in the one archive and even generate a feed for that? “http://your-blog-uri/?tag=tag1,tag2” this would get all the posts tagged with tag1 or tag2. “http://your-blog-uri/?tag=tag1+tag2” this would get all the posts tagged with tag1 and tag2 “http://your-blog-uri/?tag=tag1,tag2&feed=rss” this would get you an RSS feed for all the posts tagged with tag1 or tag2 Neat huh? But did you notice that on the generated tag page you see only one tag listed in the header? This function fixes that and displays all tags used to generate that tag archive. It does this by silently modifying the single_tag_title template tag. It’ll even work on the RSS feed generated by that page! What would be also be cool is to be able to intersect categories and tags so you could grab posts with tags from a specific category for example? With this plugin you can. It’s not perfect however. It only allows intersection between a single category and one or more tags. Technically WordPress should be able to support multiple categories and tags intersections but it didn’t work for me in WordPress 2.3.x and 2.5. So go to one of your category pages. If your using using fancy permalinks then at the end of the url add “?tdo_tag=a_tag“. If your not using permalinks then you can just use “&tdo_tag=a_tag“. You must use the tag slug, not the full tag name. You can use multiple tags as above using “,” and “+”. Example not using fancy permalinks: “http://your-blog-uri/?cat=35&tdo_tag=tag1,tag2” this would get all posts in category with id 35 and tagged with either tag1 or tag2. Example using fancy permalinks: “http://your-blog-uri/category/mycategory/?tdo_tag=tag1+tag2” this would get all posts in the category “mycategory” and tagged with both tag1 and tag2. This plugin uses this intersection code to automatically modify the built-in tag cloud template tag wp_tag_cloud so that if it is used on a category archive, it shows only the tags within that category. You can then click on a tag in that tag cloud and it will get the posts for in that category that tagged with that tag. (You can disable this and just use the specific template as you need). Some more tag tricks If you want to sort results on page generated by using the tdo_tag you can just append orderby and order to the URL. For example: “http://your-blog-uri/?cat=35&tdo_tag=tag1,tag2&orderby=title&order=asc“ Thanks to Tobias Ross who figured this out. You could of course stick this in the fancy permalink if you’re okay with doing a little hacking. Version History v0.5: 4th July 2008 Fixed a potential problem with global variables The “or” tag functionality for tags with a category didn’t work. Fixed. v0.4: 8th April 2008 The tag cloud had a “small” bug, it only gathered the tags from the posts on the first page of the category, not all the posts on the category! Doh. Thanks to Tobias Ross for helping me to get to the bottom of it. v0.3: 7th April 2008 Small bug fixed. Setting $tdotf_fix_tag_cloud_auto to false did not deactivate the automatic tag cloud modification. Tag cloud now properly supports exclude, include and number arguments New template tag: tdotf_the_tags A basic permalink redirection (as requested) v0.2: 20th December 2007 Added a tag cloud based on the built-in tag cloud that shows tags from a single category. v0.1: 6th December 2007 First release

Download now