Title: TDO Tag Fixes
Author: the_dead_one
Published: <strong>2007 年 12 月 20 日</strong>
Last modified: 2008 年 7 月 4 日

---

搜索插件

**该插件尚未通过WordPress的最新3个主要版本进行测试**。 当与较新版本的WordPress一起
使用时，可能不再受到维护或支持，并且可能会存在兼容性问题。

![](https://s.w.org/plugins/geopattern-icon/tdo-tag-fixes.svg)

# TDO Tag Fixes

 作者：[the_dead_one](https://profiles.wordpress.org/the_dead_one/)

[下载](https://downloads.wordpress.org/plugin/tdo-tag-fixes.0.5.zip)

 * [详情](https://cn.wordpress.org/plugins/tdo-tag-fixes/#description)
 * [评价](https://cn.wordpress.org/plugins/tdo-tag-fixes/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/tdo-tag-fixes/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/tdo-tag-fixes/#developers)

 [支持](https://wordpress.org/support/plugin/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.](http://boren.nu/archives/2007/10/01/taxonomy-intersections-and-unions/)

**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 the zip and extract the files to a subdirectory, called tdo-tag-fixes, 
of your plugin directory. i.e. `/path_to_wordpress/wp-content/plugins/tdo-tag-fixes`.

Once you’ve got it installed, active the plugin via the usual WordPress plugin menu.

#### Configuring

To configure the plugin, you must open up tdotf.php in your favourite text editor
and look for these lines:

    ```
    // 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 = true;
    ```

#### New Template Tags

    ```
    tdotf_cat_tag_cloud works exactly like [`wp_tag_cloud`]( https://codex.wordpress.org/Template_Tags/wp_tag_cloud ) and takes all the same arguments except if called on a category archive/template it will display only the tags in that category. It has one additional argument, "cat" can be used to indicate a specific category. If this is not specified it will take the category id of the category template it is in. By default this plugin will automatically change `wp_tag_cloud` so that if it's called on a category archive, it'll use `tdotf_cat_tag_cloud`.

    tdotf_tag_title and `tdotf_get_tag_title` can be used in place of [`single_tag_title`](https://codex.wordpress.org/Template_Tags/single_tag_title ). It can handle the usage of multiple tags in the URL. By default this plugin will automatically change `single_tag_title` so that if it's use in a tag archive that uses multiple tags, it'll use `tdotf_tag_title` (or `tdotf_get_tag_title`).

    tdotf_the_tags can be used in place of [`the_tags`](https://codex.wordpress.org/Template_Tags/the_tags) and if used in a category archive, the tag links will point to the category archive filtered by the tag.
    ```

## 评价

此插件暂无评价。

## 贡献者及开发者

「TDO Tag Fixes」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ the_dead_one ](https://profiles.wordpress.org/the_dead_one/)

[帮助将「TDO Tag Fixes」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/tdo-tag-fixes)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/tdo-tag-fixes/)，查看
[SVN仓库](https://plugins.svn.wordpress.org/tdo-tag-fixes/)，或通过[RSS](https://plugins.trac.wordpress.org/log/tdo-tag-fixes/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/tdo-tag-fixes/)。

## 额外信息

 *  版本 **0.5**
 *  最后更新：**18 年前**
 *  活跃安装数量 **90+**
 *  WordPress 版本 ** 2.3 或更高版本 **
 *  已测试的最高版本为 **2.5.1**
 *  语言
 * [English (US)](https://wordpress.org/plugins/tdo-tag-fixes/)
 * 标签
 * [fixes](https://cn.wordpress.org/plugins/tags/fixes/)[intersection](https://cn.wordpress.org/plugins/tags/intersection/)
   [tag](https://cn.wordpress.org/plugins/tags/tag/)[tag cloud](https://cn.wordpress.org/plugins/tags/tag-cloud/)
   [tags](https://cn.wordpress.org/plugins/tags/tags/)
 *  [高级视图](https://cn.wordpress.org/plugins/tdo-tag-fixes/advanced/)

## 评级

 5 星（最高 5 星）。

 *  [  1 条 5 星评价     ](https://wordpress.org/support/plugin/tdo-tag-fixes/reviews/?filter=5)
 *  [  0 条 4 星评价     ](https://wordpress.org/support/plugin/tdo-tag-fixes/reviews/?filter=4)
 *  [  0 条 3 星评价     ](https://wordpress.org/support/plugin/tdo-tag-fixes/reviews/?filter=3)
 *  [  0 条 2 星评价     ](https://wordpress.org/support/plugin/tdo-tag-fixes/reviews/?filter=2)
 *  [  0 条 1 星评价     ](https://wordpress.org/support/plugin/tdo-tag-fixes/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/tdo-tag-fixes/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/tdo-tag-fixes/reviews/)

## 贡献者

 *   [ the_dead_one ](https://profiles.wordpress.org/the_dead_one/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/tdo-tag-fixes/)

## 捐助

您愿意支持这个插件的发展吗?

 [ 捐助此插件 ](http://tinyurl.com/2mo6up)