內容簡介
這個外掛會在 WordPress 的 wp_list_pages() 和 wp_nav_menu() 函式所產生的 LI 標籤中,新增類別或 ID(由您選擇)。
在沒有存取這些屬性的情況下,要對這些選單的輸出進行樣式設計非常困難。這個外掛允許您使用 CSS 調整 wp_list_pages() 和 wp_nav_menu() 的輸出樣式。
類別名稱或 ID 來自頁面的 URL。
例如,
/about/ 可能會有類別 about。
/about/faq/ 可能會有類別 about_faq。
如果一個頁面沒有 URL(例如您的首頁),該外掛會將 class 或 id(取決於您選擇哪一個)設置為 frontpage,並添加您所請求的任何前綴。
例如,
/ 可能會有類別 pg_frontpage。
現有的類別(例如 page_item 或 current)不會受到影響。
範例輸出
<li id="nav-a-new-page" class="first page_item page-item-4"><a href="http://example.com/a-new-page/" title="A new page">A new page</a></li>
<li id="nav-about" class="page_item page-item-2"><a href="http://example.com/about/" title="About">About</a></li>
<li id="nav-another-new-page" class="last page_item page-item-6"><a href="http://example.com/another-new-page/" title="Another new page">Another new page</a></li>
設定
您可以使用選項面板中的 Classy wp_list_pages 分頁,在設定分頁中選擇使用 ID 或類別,設置標記分隔符號,以及新增可選的標記前綴。
您也可以指定要在列表中的第一項和最後一項添加的類別。
非常簡單明瞭。
聯繫和致謝
由 Alex Dunae 撰寫(dunae.ca)在 2007-09 年,電子郵件為相同域名下的 'code'。
外掛標籤
開發者團隊
② 後台搜尋「Plugin Name: Classy wp_list_pages」→ 直接安裝(推薦)
原文外掛簡介
This plugin adds classes or IDs (your choice) to the LI tags generated by WordPress’ wp_list_pages() and wp_nav_menu() functions.
I found it very frustrating to style the output of these menus without having access to these attributes. This plugin allows you to style the output of wp_list_pages() and wp_nav_menu() with CSS.
The class name or ID is derived from the URL of the page.
For example,
/about/ could have the class about.
/about/faq/ could have the class about_faq.
If a page does not have a URL (e.g. your front page) the plugin will set the class or id (depending on what you selected) to frontpage, adding whatever prefix you requested.
For example,
/ could have the class pg_frontpage.
Existing classes (e.g. page_item or current) are left untouched.
Sample output
Configuration
Using the Classy wp_list_pages tab in the options panel you can choose whether you want to use IDs or classes, set the token separator and add an optional token prefix.
You can also specify a class to add to the first and last items in a list.
Pretty straight forward…
Contact and Credits
Written by Alex Dunae ( dunae.ca ), e-mail ‘code’ at the same domain), 2007-09.
