[WordPress] 外掛分享: Duplicate Widget

前言介紹

  • 這款 WordPress 外掛「Duplicate Widget」是 2011-12-11 上架。
  • 目前有 2000 個安裝啟用數。
  • 上一次更新是 2017-11-28,距離現在已有 2713 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 3.1 以上版本才可以安裝。
  • 有 12 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

coffee2code |

外掛標籤

widget | sidebar | widgets | duplicate | coffee2code |

內容簡介

r />

一個小工具,可以作為另一個小工具的副本(用於在另一個側邊欄中同步使用)

只需定義一次小工具,即可在多個側邊欄中使用。這樣可以避免手動配置每個小工具的麻煩,並且在以後需要進行任何更改時,也可以省去保持它們同步的煩惱。特別適用於在其主題中定義邏輯以有條件地包含不同版本的側邊欄的人。根據使用情況,這是應用於決定何時顯示小工具的小工具邏輯的替代方案(Widget Logic、Section Widget、條件小工具等)。

此外,快速概述此插件的功能:

添加一個名為“Duplicate”的小工具。小工具的唯一設置是下拉菜單,其中列出所有活動小工具。所選小工具將是副本小工具要複製的小工具。
副本小工具顯示的標題和內容與其源小工具相同,即使這些值稍後在源小工具中更改。
可以將小工具複製任意次數,在同一頁面中可以出現多次(是的,即使在同一個側邊欄中,為什麼要這樣做呢?)
副本小工具將遵循其放置的側邊欄的配置,而不是源小工具的側邊欄的配置。因此,副本小工具使用自己側邊欄的“before_widget”、“after_widget”、“before_title”、和“ after_title”值。
複製的小工具在管理員小工具標題欄中的名稱中預置“[D]”,以表示它們有副本。此外,在展開小工具並向下滾動時,也會在小工具的配置表單底部顯示一個簡短的説明,該説明說明小工具有幾個副本。
如果某個小工具被停用或刪除,如果它有任何副本,這些副本也會被刪除。
在複製小工具的標記中包含源小工具的小工具ID和小工具類型。

鏈接:插件主頁面 | 插件目錄頁面 | 作者主頁面

篩選器

該插件公開了四個操作以進行鉤取。定制利用這些鉤子的通常放在您正在使用的主題的 functions.php 文件中,或被其他插件使用。

c2c_before_duplicate_widget(動作)

“c2c_before_duplicate_widget”鉤子允許你在副本小工具輸出之前輸出文本或執行某些操作。

參數:

$ instance(array):小工具實例的設置(即:標題和widget_to_duplicate)
$ args(array):小工具和側邊欄的配置

示例:

//在複製小工具內容前輸出開始的


add_action(‘c2c_before_duplicate_widget’,‘my_c2c_before_duplicate_widget’,10,2);
function my_c2c_before_duplicate_widget($ instance,$ args){
echo ‘

}。
c2c_after_duplicate_widget(動作)

“c2c_after_duplicate_widget”鉤子允許你在副本小工具輸出之後輸出文本或執行某些操作。

參數:

$ instance(array):小工具實例的設置(即:標題和widget_to_duplicate)
$ args(array):小工具和側邊欄的配置

原文外掛簡介

A widget that can act as a duplicate of another widget (for synchronized use in another sidebar)
Define a widget once, use it in multiple sidebars. This saves you from having to manually configure each copy of the widget and later having to worry about keeping them in sync should you ever need to make any changes. Particularly useful for those who define logic in their themes to conditionally include different versions of a sidebar depending on what template is being shown. Depending on use, it is an alternative to plugins that introduce in-widget logic to determine when widgets should be visible (Widget Logic, Section Widget, Conditional Widgets, etc).
Quick overview of what this plugin does:

Adds a widget called “Duplicate”. The widget’s only setting is a dropdown listing all active widgets. The selected widget will be the widget duplicated by the duplicate widget.
A duplicate widget shows the same title and content as its source widget, even if those values later get changed in the source widget.
A widget can be duplicated any number of times and can appear multiple times within the same page. (Yes, even within the same sidebar, though why would you do that?)
A duplicate widget will abide by the configuration of the sidebar it is placed in, not the configuration of the sidebar containing the source widget. So it uses ‘before_widget’, ‘after_widget’, ‘before_title’, ‘after_title’ values of its own sidebar.
Widgets that are duplicated will have “[D]” prepended to their name in the widget titlebar in the admin to denote they have duplicates. Also, at the bottom of the widget’s configuration form (when the widget is expanded), a short blurb also explains that the widget has duplicate(s) and a count of how many duplicates it has.
If a widget is deactivated or deleted, if it has any duplicates, they get deleted as well.
The widget id and widget type of the source widget are included as HTML classes in the duplicate widget’s markup.

Links: Plugin Homepage | Plugin Directory Page | Author Homepage
Filters
The plugin exposes four actions for hooking. Typically, customizations utilizing these hooks would be put into your active theme’s functions.php file, or used by another plugin.
c2c_before_duplicate_widget (action)
The ‘c2c_before_duplicate_widget’ hook allows you to output text, or perform some sort of action, just before the output of the duplicate widget.
Arguments:

$instance (array) : The settings for the widget instance (namely: title and widget_to_duplicate)
$args (array) : The configuration for the widget and sidebar

Example:
// Output an opening

before duplicate widget content
add_action( 'c2c_before_duplicate_widget', 'my_c2c_before_duplicate_widget', 10, 2 );
function my_c2c_before_duplicate_widget( $instance, $args ) {
echo '
;
}

c2c_after_duplicate_widget (action)
The ‘c2c_after_duplicate_widget’ hook allows you to output text, or perform some sort of action, just after the output of the duplicate widget.
Arguments:

$instance (array) : The settings for the widget instance (namely: title and widget_to_duplicate)
$args (array) : The configuration for the widget and sidebar

Example:
// Output an closing

after duplicate widget content
add_action( 'c2c_after_duplicate_widget', 'my_c2c_after_duplicate_widget', 10, 2 );
function my_c2c_after_duplicate_widget( $instance, $args ) {
echo '

;
}

c2c_before_duplicate_widget_form (action)
The ‘c2c_before_duplicate_widget_form’ hook allows you to output text, or perform some sort of action, just before the output of the duplicate widget’s configuration form (in the WP admin).
Arguments:

$instance (array) : The settings for the widget instance (namely: title and widget_to_duplicate)

Example:
// Display a message just before the duplicate widget settings form
add_action( 'c2c_before_duplicate_widget_form', 'my_c2c_before_duplicate_widget_form' );
function my_c2c_before_duplicate_widget_form( $instance ) {
echo '

Note: this is a note above the widget settings form.

';
}

c2c_after_duplicate_widget_form (action)
The ‘c2c_after_duplicate_widget_form’ hook allows you to output text, or perform some sort of action, just after the output of the duplicate widget’s configuration form (in the WP admin).
Arguments:

$instance (array) : The settings for the widget instance (namely: title and widget_to_duplicate)

Example:
// Display a message just after the duplicate widget settings form
add_action( 'c2c_after_duplicate_widget_form', 'my_c2c_after_duplicate_widget_form' );
function my_c2c_after_duplicate_widget_form( $instance ) {
echo '

Note: this is a note below the widget settings form.

';
}

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Duplicate Widget」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


1.0 | 1.0.1 | 1.0.2 | trunk |

延伸相關外掛(你可能也想知道)

  • One Click Demo Import 》這個外掛的最佳功能在於主題作者可以在他們的主題中定義導入文件,所以所有使用該主題的用戶只需點擊「導入演示數據」按鈕即可。, , 你是主題作者嗎?, 為你...。
  • Premium Addons for Elementor 》使用超過60個高度可自訂的外掛和小工具以及400多個預製範本,讓你能夠無需編碼更快地建立複雜的網站,提升你的Elementor頁面建構器的能力。Elementor和Premiu...。
  • Ocean Extra 》mplates IMPORT, With Ocean Extra, you get access to a wide range of both free and premium website templates to import to your website with a single...。
  • SiteOrigin Widgets Bundle 》rdPress website since 2013. Our Widgets Bundle is actively developed and regularly updated to ensure compatibility with the latest WordPress update...。
  • Jeg Elementor Kit 》這是為了 Elementor 頁面建構器所設計的額外小工具,它包含 40 種高度可自訂的小工具。, 必要小工具, 我們提供小工具,您可以按照自己的需求進行自訂。, , 手...。
  • Blocksy Companion 》Blocksy Companion 是一個外掛,將 Blocksy 主題轉化為強大的瑞士軍刀工具。, 只有在安裝並啟用 Blocksy 主題時,它才會運行並添加增強功能。, 最小需求, , W...。
  • WooSidebars 》使用 WooSidebars,您可以根據情境(例如特定頁面、特定博客文章、某些類別或搜尋結果屏幕)更改顯示在側邊欄(小部件區域)中的小部件。設置顯示在多個條件...。
  • Widget Importer & Exporter 》Widget Importer & Exporter 是一個有用的外掛,可將小工具從一個WordPress站點移動到另一個站點,備份小工具,並供主題開發人員為用戶提供範例小工具。...。
  • Unyson 》, 您覺得這款外掛有幫助嗎?請考慮給它一個五星評價。, , Unyson - 一個免費的拖放框架,附帶許多內建的擴充功能,可以協助您輕鬆快速地開發高級主題。, 贊助...。
  • Orbit Fox by ThemeIsle 》透過Orbit Fox,您可以使用各種模組擴充您的主題功能,例如社交媒體分享按鈕和圖示、自訂選單圖示、頁首和頁尾腳本、一鍵導入頁面模板、頁面建構器附加元件和...。
  • Widget CSS Classes 》Widget CSS Classes 可以讓您給 WordPress Widget 添加自定義的 class 和 id, 請注意,此外掛並不支援輸入自定義的 CSS。您需要修改主題的 style.css,或加入...。
  • Lightweight Sidebar Manager 》通常您會在網站上看到一個側邊欄,但有時需要在特定頁面上顯示相關的不同側邊欄。例如,在 WooCommerce 頁面上,顯示相關或熱門產品的側邊欄比最新評論或博客...。
  • Sidebar Widgets by CodeLights 》❗ 很抱歉,由於 SiteOrigin 的 widgets API 完全更改,CodeLights 不再支援 SiteOrigin Page Builder 的原生使用。解決方案:您仍然可以在純文字編輯器中創...。
  • Widget Context 》使用 Widget Context 外掛在網站的特定部分 (如首頁、文章、頁面、檔案、搜尋等) 中顯示或隱藏小工具。該外掛可支援使用 URL 定位來達到最大的彈性。, , 高級...。
  • UiCore Elements – Free Elementor widgets and templates 》```html, , , , ,

    UiCore Elements 外掛總結:

    ,

    UiCore Elements 是一個多功...。

文章
Filter
Apply Filters
Mastodon