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).
Administrator
April 21st, 2008 at 9:09 am
No problem Confuscius!
Hi indojepang, what do you mean a “Blank Screen”? Does it literally kill your MU install?
Guest
April 20th, 2008 at 11:32 pm
Hi Mark
Many thanks for the point in the right direction - I ended up replacing the tag cloud code in widgets.php with your suggested code and the addition of a ‘&order=DESC’ - this gives me a category tag cloud for each category where all tags point back at the global tags sorted high to low on the tag count - just what the doctor ordered. Neat.
Kind regards.
Guest
April 20th, 2008 at 10:12 am
Hi sorry for late reply..
Yes! Your Plugin is Rock man! it works great for WP 2.5.. Thank u..
FYI I tested in WPMU and got Blank screen..
Just for testing..
But it would be great if it works in WPMU too..
Cheers..
Administrator
April 16th, 2008 at 8:35 am
Hi Confuscius,
From the look of it, you have the settings for the plugin correct.
How are you calling the wp_tag_cloud function? What are the parameters?
What you could try instead is called tdotf_cat_tag_cloud directly on the category archive template and disable the auto replace. By default the orderby is set to “name” so you need to change the orderby to count to list the top X tags. So you could called the tag cloud function like this:
tdotf_cat_tag_cloud('orderby=count&number=50');This would give you the tdotf tag cloud with the tags ordered by count (not alphabetically) and limited to the top 50.
Administrator
April 16th, 2008 at 8:27 am
Hi indojepang,
The modified tag cloud works pretty much the same as the built in WP tag cloud with one additional parameter “cat”.
So if you want to use a specific category, find out it’s category ID, say 6 for our example. Then you can just called the tag cloud function like this:
if(function_exists('tdotf_cat_tag_cloud')) {
tdotf_cat_tag_cloud('cat=6');
}
You can use all the normal tag cloud parameters too. Is that what you are looking for?
Guest
April 15th, 2008 at 3:17 pm
Congratulations on a superb plugin idea. I have tried to get t doing what I want it to do but I am struggling! Please help!
I ahve a standard Wordpress2.5 install, a widget enable template showing the tag cloud. I have installed the plugin. the only change that I made to WP2.5 was that in widgets.php then I set the smallest and largest sizes and changed the number of tags to show.
Next step was to edit tdotf.php to:
============================================================
// You can change this if you want. Do not set it to ‘tag’. If you want to
// disable this feature, just comment it out.
//
// $tdotf_tag_get_var = ‘tdo_tag’;
// If you have fancy permalinks turned on, you can use this option to use a
// more fancy form of the tdo_tag. The first paramater is the category_slug
// and the second parameter is the tag_slug. If you want to disable this feature
// just comment it out. (It depends on $tdotf_tag_get_var)
//
// $tdotf_fancy_tag_regex = ‘tdo_cat/(.+)/tdo_tag/(.+)’;
// Set to false if you do not wish tag archive titles to be correctly updated
//
$tdotf_fix_tag_title_auto = true;
// Set to false if you do not wish the built-in tag cloud automatically fixed
//
$tdotf_fix_tag_cloud_auto = true;
// Set to false if you do not wish the category archive title to include tag filter
//
$tdotf_fix_cat_title_auto = false;
// Enable some debug
//
$tdotf_enable_debug = false;
================================================
The idea being that on each category then I would show a list of tags within that category but each tag link would point to the overall top level tag directory set up under my permalinks.
The tag clouds are generated in each category BUT they are the first 50 alphabetically listed and not a cloud of the top 50 tags.
Can anyone advise on where I have gone wrong or is this a bug?
Thanks in advance for the help.
Guest
April 13th, 2008 at 5:12 am
I mean how to wrote this on home.php for wp_tag_cloud() from specific category only?
Guest
April 13th, 2008 at 5:01 am
My head is spinning too fast with this!!
simple question: how to write tag cloud from specific category?
Guest
April 12th, 2008 at 10:46 am
Great plugin thank you
Guest
April 8th, 2008 at 8:50 pm
The database I am building on my site would not be possible without this plug-in or a non-existent one that does the same things!?
I think the Wordpress people should roll it back into wordpress! Yes, 2.3 brought tag intersections… but doesn’t exposing category and tag+tag intersections make just as much sense if not more!?
Oh the pretty cloud!
Great work Mark!