[WordPress] 外掛分享: Add URL Slugs as Body Classes

首頁外掛目錄 › Add URL Slugs as Body Classes
800+
安裝啟用
★★★★
4.8/5 分(5 則評價)
3960 天前
最後更新
問題解決
WordPress 3.1+ v1.3 上架:2012-02-24

內容簡介

此外掛會將 URL 轉換成多個片段作為 body 標籤的額外
分類。例如,如果您的頁面 URL 是:
http://www.example.com/2012/02/24/wordpress-plugin-add-url-slugs-as-body-classes/
您的頁面 body 標籤會擁有這些分類:
2012 02 24 wordpress-plugin-add-url-slugs-as-body-classes

當您開始思考分類或交錯頁面時,情況就會變得更加強大:
http://www.example.com/category/wordpress/
會新增以下分類:
category wordpress

http://www.example.com/movies/star-trek/wrath-of-khan/
會新增以下分類:
movies star-trek wrath-of-khan

這使您能夠根據這些新的 CSS 分類非常輕鬆地為這些頁面添加自定義 CSS 和/或 JS。

如有任何問題、建議或想法,請告訴我。
Atg
http://aarontgrogg.com/
[email protected]

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.3) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Add URL Slugs as Body Classes」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

This plug-in takes the URL, chops it into pieces, and adds each “piece” as an additional
class to the body tag.
Meaning, if your page’s URL is:
http://www.example.com/2012/02/24/wordpress-plugin-add-url-slugs-as-body-classes/
Your page’s body tag would have at least these classes:
2012 02 24 wordpress-plugin-add-url-slugs-as-body-classess
It gets much stronger when you start thinking about Categories or nested Pages:
http://www.example.com/category/wordpress/
which would add:
category wordpress
while:
http://www.example.com/movies/star-trek/wrath-of-khan/
would add:
movies star-trek wrath-of-khan
This allows you to very easily add custom CSS and/or JS to these pages based on these new CSS classes.
Please let me know if you have any questions/suggestions/thoughts,
Atg
http://aarontgrogg.com/
[email protected]

延伸相關外掛

文章
Filter
Apply Filters
Mastodon