Downloads: TDO Tag Fixes Wordpress Plugin (0.5)
Some fixes and extensions for Wordpress tags such as a tag cloud using only tags found in a specific category and also tag and category intersection.
Download Plugin Now from Wordpress.org!
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).
Guest
June 13th, 2008 at 6:38 am
Hi,
You got a really great plugin going here, I was about to code something similar myself when I can across it. I’ve had it working quite nicely and added a few enhancements which can be seen at http://www.easymapinfo.com/wordpress25/category/australia/ (still under dev).
The problem that I was having is when intersecting a category and multiple tags expecting an ‘OR’ join to take place and was getting a ‘AND’ join result. eg …/categoryname/?tdo_tag=tag1,tag2. The plugin correctly modifies the title but the result is definitely a ‘AND’ join.
So I threw a virgin WP install at http://easymapinfo.com/virginwordpress/?cat=3 with only your plugin and it does the same thing.
Thoughts?
Guest
June 11th, 2008 at 5:46 am
Here are the plugins I have activated (latest versions):
Askimet
Simple Tags
Subscribe to comments
Wordpress Database Backup
WP-Footnotes
I have tried disabling each plugin, but that didn’t fix it. I searched for wp_query in my theme (Tarski), but nothing was found. I’m running PHP 4.4.7 and MySQL 4.1.22. Thanks for your help.
Administrator
June 9th, 2008 at 9:45 am
Hi Philip, did you try disabling Simple Tags plugin (just in case their is a conflict)? Are you using any plugins that might be modifying WP_Query (i.e. messing with the order of posts in the template)?
Guest
June 8th, 2008 at 1:04 am
I really appreciate the effort, but it still isn’t working. Here is an example link:
http://philip.yurchuk.com/category/software/?tdo_tag=rhino
You can see there are a couple posts that don’t have the rhino tag.
Administrator
June 3rd, 2008 at 9:28 am
Hi Philip Yurchuk, I’ve just done a small update to the plugin that might solve your problem. Could you try the dev version and tell me if that makes a difference?
Thanks
Guest
June 3rd, 2008 at 3:24 am
Hi, it’s me again. I still can’t get the category/tag intersection to work. I’m now using WP 2.5.1, TDO Tag Fixes .4, and SimpleTags 1.5.7 (plus a few non-tag related plugins). Here is an example link:
http://philip.yurchuk.com/category/software/?tdo_tag=rhino
You’ll see there are multiple posts listed when there really should be only one. This feature would be extremely useful for another blog I’ve set up. I have the same exact setup there, and it also doesn’t work, but I don’t mind experimenting on my personal blog if you need more info.
Thanks!
Guest
May 13th, 2008 at 4:11 pm
hi. Thanks for plugin
perfect.
regards
Administrator
April 24th, 2008 at 9:24 am
Thanks Queenvictoria,
I was a bit unsure if it made sense to have it point to the category+tag when your on a single page. What happens if you have multiple categories for a post? You’ll only get the 1st category!
I’ll see about rolling in the chance with some additional enhancements (like allow the user to specify what category to use)
Guest
April 24th, 2008 at 4:05 am
hi mark .thanks of course
to fix the (tdof_)the_tags() on is_single() pages, i added this to your tdof_the_tags()
function tdof_the_tags( $before = '', $sep = '', $after = '' ) {
global $tdotf_tag_get_var,$cat;
// mr.snow - we need to get the category another way if !is_category()
if ( ! $cat ) {
$category = get_the_category();
$cat = $category[0]->cat_ID;
}
// if(is_category() && isset($tdotf_tag_get_var)) {
if(isset($cat) && isset($tdotf_tag_get_var)) {
…
Guest
April 21st, 2008 at 2:31 pm
putting this plugin into mu-plugins directory gets me a blank screen (nothing shows up), unplugged it and back to normal again.. (for a second my heart stopped beating.. lol)