DiggingIntoWordPress

by Chris Coyier & Jeff Starr

Daily archives: Monday, April 12, 2010

Call a Widget with a Shortcode

Posted by on

We covered how to run a shortcode in a widget. But what about inserting a widget with a shortcode? I recently had this situation come up. I had a single page where I just wanted to be able to chuck in a widget without the whole rigmarole of creating a special widgetized area and probably a custom page template for that widgetized area and such. I wanted to just put [widget widget_name=”my_widget”] in the pages content and have that widget pop in. Turns out it wasn’t as easy I wanted it to be, but it’s not that bad…

Code is poetry