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