Compatible with PHP 8.0
Widget Alias allows you to create an «alias» of any existing widget, effectively reproducing / duplicating it. This can be especially handy when you want the same widget to appear in multiple sidebars. Normally you would have to edit each widget independently, but Widget Alias means you’ll only have to edit one.
A MIGHTYminnow plugin.
This plugin is similar to Duplicate Widget, with a few key differences:
- Widget Alias gives you the option to override the aliased widget’s title.
- Widget Alias uses AJAX to update the drop-down
<select>menus on the fly, which means you see widget changes (adding widgets, deleting widgets, re-ordering widgets, etc) in real time.
- If you delete a widget that is being aliased, the aliased copies simply revert to «None», instead of being deleted. This allows you to keep track of where you’ve used Widget Alias widgets, if need be.
Widget Alias can be used in one of two ways:
In Appearances > Widgets you’ll see a new widget called «Widget Alias», in which you can specify an override title if desired, and use the drop-down
<select> menu to choose the ID of the widget you would like to alias.
Widget Alias also comes packaged with a shortcode that looks like this:
[widget_alias id=»target-widget-id» title=»Override Title»]
To use the shortcode simply enter the ID of the widget you would like to alias (
id parameter), and an override title (
title parameter) if you would like to change the aliased widget’s title.
Removing / Deleting Aliased Widgets
Widget Alias makes it easy to tell which widgets are being aliased – each aliased widget has a note below its widget controls letting you know how many times it is aliased. If you delete an aliased widget, the Widget Alias widgets that previously pointed to it will revert to the default alias value of «None.»
Banner photo by Susannah Kay.
Install and activate the plugin. That’s it! You’ll now have access to the Widget Alias widget via Appearance > Widgets, as well as the
Contributors & Developers
“Widget Alias” is open source software. The following people have contributed to this plugin.Contributors
- Fix deprecated «ready» event.
- Update jQuery to show widget ID’s in the customizer.
- Enqueue scripts and styles only on the widgets and customizer pages.
- Refactor code to enclose previously global variables/functions, and prefix all functions.
- Fix deprecated widget constructor call.
- Fix issue with shortcode method throwing error.
- Add missing .pot file.
- Add extra JS conditional to prevent AJAX errors.
- Fixed bug in which Widget Alias would cause all widgets to disappear
- Added more efficient jQuery
- Improved admin styling
- Fixed bug in which Widget Alias was simply echoing widget output, instead of returning it in the correct location.
- Further modifications to JS and CSS to utilize default WP admin classes for improved aesthetics.
- Modified JS and CSS to improve the display of each widget’s ID
- First release