[WordPress] 外掛分享: TDO Tag Fixes

前言介紹

  • 這款 WordPress 外掛「TDO Tag Fixes」是 2007-12-19 上架。
  • 目前有 100 個安裝啟用數。
  • 上一次更新是 2008-07-04,距離現在已有 6148 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 2.3 以上版本才可以安裝。
  • 有 1 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

the_dead_one |

外掛標籤

tag | tags | fixes | tag cloud | intersection |

內容簡介

這個外掛程式僅用作實現標籤和分類的交集的示例。然而,在最近它增加了一些功能。請隨意在您的外掛程式中重複使用該代碼。這個外掛程式是基於此處的信息。

版本0.5啟用了真正的「或」標籤交集功能。當使用分類時,這一點之前不起作用(且沒有人注意到)。感謝Joel Giddey的發現。

WordPress 2.3引入了原生的標籤支持,非常棒。

但是您知道您可以在同一個存檔中顯示多個標籤,甚至生成一個供此用途的內容嗎?

“http://your-blog-uri/?tag=tag1,tag2”這將獲取所有標記有標籤1或標籤2的文章。
“http://your-blog-uri/?tag=tag1+tag2”這將獲取所有標記有標籤1和標籤2的文章。
“http://your-blog-uri/?tag=tag1,tag2&feed=rss”這將為標籤1或標籤2標記的所有文章生成RSS訂閲。

很不錯,對吧?但是您是否注意到在生成的標籤頁面上,您只能看到標籤列表中的一個標籤?這個函數解決了這個問題,它顯示用於生成該標籤存檔的所有標籤。它通過默認修改single_tag_title模板標籤實現。它甚至可以在由該頁面生成的RSS訂閱上工作!

接下來,可能也會很酷的是能夠交集分類和標籤,這樣您就可以抓取帶有特定分類的標籤文章?

您可以使用此外掛程式實現這一點。但它並不完美,只允許在單個分類和一個或多個標籤之間進行交集。在技術上,WordPress應該支持多個分類和標籤的交集,但在WordPress 2.3.x和2.5中卻無法工作。

因此,轉到您的某個分類頁面。如果您使用的是漂亮的永久鏈接,則在URL末尾添加「?tdo_tag=a_tag」。如果您未使用永久鏈接,則可以使用「&tdo_tag=a_tag」。您必須使用標籤別名,而不是完整的標籤名稱。如上所述,您可以使用「,」和「+」使用多個標籤。

不使用漂亮的永久鏈接的示例:「http://your-blog-uri/?cat=35&tdo_tag=tag1,tag2」,這將獲取ID為35的分類中標記為tag1或tag2的所有文章。
使用漂亮的永久鏈接的示例:「http://your-blog-uri/category/mycategory/?tdo_tag=tag1+tag2」,這將獲取標記為tag1和tag2且在分類「mycategory」中的所有文章。

此外掛程式使用此交集代碼自動修改內置的標籤雲模板標籤wp_tag_cloud,因此如果它在分類存檔中使用,它僅顯示該分類中的標籤。然後,您可以在標籤雲中單擊標籤,它會為該標籤獲取帶有該標籤的該分類中的文章。(您可以禁用此功能,僅按需要使用特定模板)。

一些更多的標籤技巧

如果您想在使用tdo_tag生成的頁面上對結果進行排序,只需將orderby和order附加到URL即可。例如:

“http://your-blog-uri/?cat=35&tdo_tag=tag1,tag2&orderby=title&order=asc“

感謝Tobias Ross。您當然可以將其放入漂亮的永久鏈接,如果您願意進行一些編輯。

版本歷史
v0.5:2008年7月4日

修復了全局變量可能存在的問題
為具有“或”標籤功能的標籤添加了支持

原文外掛簡介

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

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「TDO Tag Fixes」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


0.1 | 0.2 | 0.3 | 0.4 | 0.5 | trunk |

延伸相關外掛(你可能也想知道)

  • Pages with category and tag 》在頁面中新增分類和標籤。。
  • WordPress Tag, Category, and Taxonomy Manager – AI Autotagger 》axoPress allows you to show a customizable display of the terms assigned to the current post. You can choose which taxonomy and which format to dis...。
  • WP Translitera 》這是一個可用於轉換文章、頁面、標籤、媒體和檔案等永久連結的轉換插件。, This is a transliteration plugin that can convert permanent links of posts, p...。
  • WP No Base Permalink 》該外掛能夠將分類基礎從您的分類永久連結中移除 (可選)。默認情況下啟用。, 該外掛能夠從您的分類永久連結中移除父級分類 (可選)。, 該外掛能夠將標籤基礎從...。
  • Term Management Tools 》請注意,此外掛需要至少 PHP 7.1。, 如果您需要重新組織標籤和分類,此外掛可以讓您更輕鬆地進行操作。它在條目管理頁面的“批次操作”下拉菜單中添加了三個新...。
  • Taxonomy Images 》在你的主題中顯示圖像, 有一些過濾器可以在你的主題中使用,來顯示此外掛創建的圖像關聯。請閱讀以下詳細信息。, 顯示代表術語檔案庫的單個圖像, 以下過濾器...。
  • PS Taxonomy Expander 》PS Taxonomy Expander 可以讓您更輕鬆地在編輯文章時使用類別、標籤和自訂分類法。, 功能, , 啟用將分類法核取方塊變成有階層的單選按鈕功能。, 讓您在 WordP...。
  • Cool Tag Cloud 》此外掛會以專業設計的標籤圖像作為背景,呈現標籤雲。, 此外掛的標籤雲具有完全回應式設計,可在所有瀏覽器中正確顯示。, 此外掛的主要使用方式是透過「Cool ...。
  • Category Tag Pages 》為您的頁面添加類別和標籤功能。, 此外掛會添加「post_tag」和「category」taxonomy (標籤和分類所使用的現有taxonomy名稱) 到「page」文章型別 (Post type) ...。
  • All Meta Tags 》這是一款易於使用、界面直觀的 WordPress 外掛程式,可以讓您輕鬆而安全地在 WordPress 管理區中直接添加自訂 Meta 標籤,而無需使用外部編輯器。, , 此工具...。
  • Remove Taxonomy Base Slug 》如果您想要對您的自訂文章類型文章使用更好的固定連結,並使用自訂的固定連結,這個外掛程序可以協助您。, 如果該術語的slug和文章類型相同,那麼該分類的優...。
  • Format Media Titles 》格式化媒體標題 WordPress 外掛可以讓你為新上傳的媒體項目格式化標題。手動編輯新上傳的媒體項目的標題可能會相當繁瑣。這個外掛可以自動從標題中刪除和替換...。
  • WordPress Ad Widget 》這是在您的 WordPress 網站上放置廣告最簡單的方法。只需將小工具拖到側邊欄中,上傳廣告,然後保存即可。, 觀看一個短視頻演示:https://youtu.be/E9CC3ZWOa...。
  • Auto Tag Creator 》這個外掛在儲存文章/產品標題和分類時,會自動將其中的關鍵字轉換為標籤。它包含了一個可供使用者編輯的詞彙忽略清單。其他特點如下:, , , 將文章/產品標題...。
  • Taxonomy Switcher 》這個外掛允許您選擇您的「From」和「To」分類法,以轉換所有項目。選擇一個父項可以選擇轉換項目的範圍。在輸入名稱時,將會即時搜尋包含特定名稱和子項目的...。

文章
Filter
Apply Filters
Mastodon