[WordPress] 外掛分享: Widgets in Menu for WordPress

首頁外掛目錄 › Widgets in Menu for WordPress
WordPress 外掛 Widgets in Menu for WordPress 的封面圖片
9,000+
安裝啟用
★★★★
4.8/5 分(21 則評價)
2817 天前
最後更新
問題解決
WordPress 3.5+ v1.0.0 上架:2014-10-20

內容簡介

這個外掛可以讓您透過在自訂小工具區域和選單編輯畫面中的額外方塊,將小工具加入 WordPress 導覽選單中。

警告

為了讓小工具正確顯示在導覽選單中,您需要具備一些 CSS 技能。

使用方式

請查看截圖以獲得使用說明。

原始程式碼和貢獻

在 Github 上派生

我們非常歡迎貢獻。

文件

大部分文件都在內嵌中。
鉤子(動作和過濾器)在其他注意事項中有記錄。
一些有用的資訊在常見問題解答部分中。

鉤子
動作

yawp_wim_pre_callback

在小工具顯示回呼函式呼叫之前觸發。類似於 ‘dynamic_sidebar’ 動作。

參數

$yawp_wim_widget array 一個小工具引數的關聯陣列。

string $name 小工具的名稱。
string $id 小工具的 ID。
array|callback $callback 當鉤子在前端被觸發時,$callback 是一個包含小工具物件的陣列。當在後端被觸發時,$callback 是 ‘wp_widget_control’,請參見 $_callback。
array $params 多重小工具引數的關聯陣列。
string $classname 套用到小工具容器的 CSS 類別。
string $description 小工具的描述。
array $_callback 當鉤子在後端被觸發時,$_callback 會被填充成一個包含小工具物件的陣列,請參見 $callback。

過濾器

yawp_wim_attribute_prefix

過濾 HTML 顯示中使用的類別/id 屬性中使用的前綴。

參數

$default_prefix string 預設前綴:‘yawp_wim’

yawp_wim_widget_params

過濾傳遞至小工具顯示回呼函式的引數。類似於 ‘dynamic_sidebar_params’ 過濾器

參數

$params array

array $args 包含小工具顯示引數的陣列。

string $name 小工具所分配的邊欄名稱。
string $id 小工具所分配的邊欄 ID。
string $description 邊欄描述。
string $class 套用到邊欄容器的 CSS 類別。
string $before_widget 在邊欄中每個小工具之前加入的 HTML 標記。
string $after_widget 在邊欄中每個小工具之後加入的 HTML 標記。
string $before_title 在顯示小工具標題時加入的 HTML 標記。
string $after_title 在顯示小工具標題時加入的 HTML 標記。
string $widget_id 小工具的 ID。
string $widget_name 小工具名稱。 }

array $widget_args 包含多個小工具引數的關聯陣列。

int $number 用於同一小工具的多個複本的數量增量。

yawp_wim_no_widgets_message

過濾在邊欄中未顯示小工具時顯示的 HTML。

參數

$no_widgets_output array 預設輸出

外掛標籤

開發者團隊

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

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

原文外掛簡介

Allows you to add Widgets in WordPress Navigation Menus via a custom widget area and an extra box in menu edit screen.

Warning
You will need to have some CSS skills for the widgets to display properly in nav menus.

Usage
View the screenshots for usage instructions.
Source code and Contributions
Fork on Github
Contributions are always welcome
Documentation

Most documentation is inline.
The hooks (actions and filters) are documented in the Other Notes.
Some useful stuff is in the FAQ section.

Hooks
Actions
yawp_wim_pre_callback
Fires before a widget’s display callback is called. Similar to ‘dynamic_sidebar’ action.
Parameters

$yawp_wim_widget array An associative array of widget arguments.

string $name Name of the widget.
string $id Widget ID.
array|callback $callback When the hook is fired on the front-end, $callback is an array containing the widget object. Fired on the back-end, $callback is ‘wp_widget_control’, see $_callback.
array $params An associative array of multi-widget arguments.
string $classname CSS class applied to the widget container.
string $description The widget description.
array $_callback When the hook is fired on the back-end, $_callback is populated with an array containing the widget object, see $callback.

Filters
yawp_wim_attribute_prefix
Filters the prefix used in class/id attributes in html display.
Parameters

$default_prefix string The default prefix: ‘yawp_wim’

yawp_wim_widget_params
Filter the parameters passed to the widget’s display callback. Similar to ‘dynamic_sidebar_params’ filter
Parameters

$params array

array $args An array of widget display arguments.

string $name Name of the sidebar the widget is assigned to.
string $id ID of the sidebar the widget is assigned to.
string $description The sidebar description.
string $class CSS class applied to the sidebar container.
string $before_widget HTML markup to prepend to each widget in the sidebar.
string $after_widget HTML markup to append to each widget in the sidebar.
string $before_title HTML markup to prepend to the widget title when displayed.
string $after_title HTML markup to append to the widget title when displayed.
string $widget_id ID of the widget.
string $widget_name Name of the widget. }

array $widget_args An array of multi-widget arguments.

int $number Number increment used for multiples of the same widget.

yawp_wim_no_widgets_message
Filters the html displayed if no widgets are present in the sidebar.
Parameters

$no_widgets_output array The default output

延伸相關外掛

文章
Filter
Apply Filters
Mastodon