Category Archives: Shortcode any widget

The “shortcode any widget” handles multiple instances

The shortcode any widget plugin can reference multiple instances of the same widget individually  by targeting the instances unique id.  If you use the general name without the id, it will list all widgets with that name.


[do_widget id=tag_cloud-3]


[do_widget “Tag Cloud”]

The trick is to be sure that you have the correct id’s, and the id names correct. For example, to double check I added two tag cloud widgets to my play system. The id’s ended up being “tag_cloud-3″ and “tag_cloud-4″. You also need a separate do_widget for each – don’t put in the same shortcode

  1. the underscore and the hyphen
  2. the fact that they were not numbered 1 and 2, even though I currently had no other tag cloud widgets

How to find out the widget id?

In the post or page where you have entered the shortcode, add to the url:


(replace ? with & if you already have a ?)

If the do_widget shortcode fires, then it will list your sidebars and the widget ids and a bunch of other statements. Find the shortcode sidebar and see what the id of the widget is


In some browser you can hover over your widgets or the edit links in the widget sidebar to really see what the id’s are.

How to do the shortcode any widget

and the result is……..

Multiple widget instances

Widget as shortcode – tips

Want to keep the widget title to identify it from other instances of the same widget, but want to hide the title when the widget is used in a shortcode (ie in a page)?

[do_widget widgetname title=false]

Want to reference a pre-existing widget configuration in a sidebar?

[do_widget id=widget_id sidebar=sidebar_name]

Shortcode a widget in a page or post

Available  at wordpress now – This plugin allows you to use any widget as a shortcode in a page or post with any theme.  While many plugin authors do provide a widget and a shortcode, not all do.  With this plugin there is no need to use the hybrid theme or create a special page template just to use a widget in a page or post.

For example

  • [do_widget id=tag_cloud-2]  will show the second tag cloud widget
  •  [do_widget “query posts”] will allow you to have a selection of posts listed in your page.    The plugin uses a dummy sidebar called “shortcode” which allows one to use the widgets user interface to specify the custom settings.

The shortcode sidebar is a named widget sidebar only used to set up the widget settings.

Warning: Themes with numbered (or totally unnamed sidebars) do not work well this. Somehow since the plugin is creating the shortcode sidebar rather than a theme (and plugins seem to run befor the theme code), wordpress allocates it the number one slot. Named sidebars are okay, but others relying on being no.1 or the one and only are pushed out. Fixed in version 1.12.

Primarily I have in mind that one would want to list posts by excerpts  for a category or a tag group within a discussion of the subject.  Thus one could have multiple portfolio pages.  This is achieved using  Justin Tadlocks query posts widget with this do_widget shortcode.  One could also try using the template tags shortcode plugin also by Justin Tadlock to achieve similar functionality. The differences with this plugin are

  • any widget could be used (as opposed to template tags)
  • no special UI (User Interface) needed as each widget’s own UI is used to set any settings

I’d love to hear other ways that people might decide to use this plugin.

Download: amr_shortcode_any_widget

Demonstration of t wo widgets called with shortcodes from within page or post text

Demonstration of two widgets called with shortcodes from within page or post text

The Shortcode Sidebar - Add the widgets that you wish to use as shortcodes.

The Shortcode Sidebar - Add the widgets that you wish to use as shortcodes.

Set the widget's settings

Set the widget's settings

Edit thepage, inserting the do_widget shortcode

Edit thepage, inserting the do_widget shortcode