A widget that can act as a duplicate of another widget (for synchronized use in another sidebar)
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:
Links: Plugin Homepage | Plugin Directory Page | Author Homepage
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.
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:
Example:
// Output an opening <div> 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 '<div class="a_duplicate_widget">; }
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:
Example:
// Output an closing </div> 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 '</div>; }
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:
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 '<p>Note: this is a note above the widget settings form.</p>'; }
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:
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 '<p>Note: this is a note below the widget settings form.</p>'; }
duplicate-widget.zip
inside the /wp-content/plugins/
directory for your site (or install via the built-in WordPress plugin installer)duplicate-widget.zip
inside the /wp-content/plugins/
directory for your site (or install via the built-in WordPress plugin installer)When a widget gets deactivated (dragged to the “Inactive Widgets” section of the widgets admin page) or deleted, all of its duplicates get deleted. The plugin provides numerous cues to make you aware of what widgets have duplicates.
If a widget is newly activated, any existing active duplicate widgets will not have it listed in their dropdowns immediately. Either a page reload must occur or the duplicate widget must be saved (which causes the widget to be retrieved via AJAX and thus the dropdown is regenerated).
Yes.