內容簡介
此外掛啟用後,將取消連結含有子分類的父分類於分類選單和列表中的連結。此外掛會影響 wp_list_categories 函數的輸出,以及所有使用此函數的其他外掛和小工具。
此外掛的運作方式是將父分類的連結轉換成「虛擬連結」。換句話說,它會將父目錄項目的 href 屬性替換為「#」符號。虛擬連結就像正常的連結一樣,只是當點擊時會返回到當前頁面。虛擬連結會被賦予一個內聯樣式「cursor: default」,以防止滑鼠指標在懸停在未鏈接的菜單項目上時變成手型。
此外掛與自定義分層分類相容。要創建自定義分類法詞語列表,必須設置 wp_list_categories 的「taxonomy」參數。詳細信息請參閱常見問題解答。
選項
如需配置此外掛選項,請轉到 WordPress 管理面板中的「設置」菜單,並點擊「取消父分類的連結」。
使用虛擬連結
如果取消此選項的選擇,此外掛將透過將錨點標記替換為 span 標記來取消父分類的鏈接。在某些主題中,這可能會導致 CSS 樣式出現問題。為了修復此問題,您需要為針對錨點的任何規則添加其他選擇器(有關詳細信息,請參閱常見問題解答)。如果您沒有編寫 CSS 選擇器的經驗,則強烈建議使用虛擬連結。
取消當前分類的連結
除了父分類,連帶取消當前分類的鏈接。
刪除連結標題
從鏈接中刪除標題屬性(當滑鼠懸停在菜單項目上時,停用工具提示)。這與取消父分類的鏈接無關,但許多人都需要此功能,因此我決定包含它。
取消特定分類的連結
您可以指定您要取消關聯的分類,使用逗號分隔的分類 ID 列表(例如:3,7,31)。如果您只想取消指定的分類,請選中「僅取消特定分類的連結」框。
外掛標籤
開發者團隊
② 後台搜尋「Ambrosite Unlink Parent Categories」→ 直接安裝(推薦)
原文外掛簡介
When activated, this plugin unlinks parent categories (that is, categories that have child categories underneath them in a hierarchy) in category menus and lists. It affects the output of wp_list_categories, as well as all plugins and widgets that use that function.
The plugin works by turning the parent category links into ‘dummy links’. That is, it replaces the href attribute on parent menu items with a ‘#’ (hash/pound) mark. A dummy link is just like a regular link, except that it leads back to the current page when clicked. The dummy links are given an inline style “cursor: default” to prevent the mouse pointer from turning into a hand when hovering over unlinked menu items.
The plugin is compatible with custom hierarchical taxonomies. To create a list of custom taxonomy terms, you must set the ‘taxonomy’ parameter of wp_list_categories. See the FAQ for more information.
Options
To configure the plugin options, go to the Settings menu in the WordPress admin panel and click on ‘Unlink Parent Categories’.
Use Dummy Links
If you uncheck this box, the plugin will unlink the parent categories by replacing the anchor tags with span tags. In some themes, this may cause problems with CSS styling. In order to fix this, you would need to add an additional selector to any rule that targets the anchor tags (see the FAQ for more information). If you are not experienced in writing CSS selectors, then it is strongly recommended to stick with dummy links.
Unlink Current Category
Unlink the current category, in addition to the parent categories.
Remove Link Titles
Remove the title attribute from the links (stops the tooltip from popping up when the mouse hovers over the menu items). This doesn’t have anything to do with unlinking parent categories, but it’s something a lot of people want, so I decided to include it.
Unlink Specific Categories
You can specify which categories you want unlinked, using a comma-separated list of category IDs (example: 3,7,31). If you want only the specified categories to be unlinked, then check the “Unlink specific categories only” box.
