[WordPress] 外掛分享: MAJpage Menu Class Extender

首頁外掛目錄 › MAJpage Menu Class Extender
50+
安裝啟用
★★★★★
5/5 分(1 則評價)
2384 天前
最後更新
問題解決
WordPress 3.0.0+ v1.6 上架:2011-08-11

內容簡介

此簡單的外掛程式是為了在舊版瀏覽器中支援辨識 wp_page_menu 和 wp_nav_menu 的「第一個元素」、「最後一個元素」、「父層元素」、「偶數項目」和「奇數項目」而撰寫的,進而新增這些元素的類別 (class)。

這個外掛會在選單 (<li>) 的標籤中新增如下類別 (class):

“first-menu-item”:顯示為每一個 <ul> 或 <menu> 標籤下的首個選單 child,
“last-menu-item”:顯示為每一個 <ul> 或 <menu> 標籤下的末個選單 child,
“parent-menu-item”:顯示為每一個 <ul> 或 <menu> 標籤下有另一個 <ul> 或 <menu> 的 child(也成父層),
“odd-menu-item”:顯示為每一個 <ul> 或 <menu> 標籤下的奇數 child,同時也包括首和/或末 child,

“even-menu-item”:顯示為每一個 <ul> 或 <menu> 標籤下的偶數 child,同時也包括首和/或末 child。

以上的類別 (class) 會分別加入至每個選單層級。此外掛程式使用 SimpleXML extension,且需要 PHP 5 或更高版本。選單內容應具有有效的 XHTML 程式碼。

外掛標籤

開發者團隊

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

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「MAJpage Menu Class Extender」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

This simple plugin was written to add classes to first, last, parent, even and odd elements of wp_page_menu and wp_nav_menu to support recognizing it in older browsers without :first-child, :last-child and :nth-child supporting.
Plugin adds the following classes to menu

  • tags:

    “first-menu-item” to every first child of

  • 文章
    Filter
    Mastodon