This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Reply To: Floating widget area as shortcode

#2978
Jason Bobich
Keymaster

I think you could pretty easily show a widget area in a shortcode, but it honestly really wouldn’t even have much to do with the theme. I suppose you’d be creating the widget area under Appearance > Widget Areas, but outside of that all the functionality would just be basic WordPress stuff. Something like this, maybe:

[widget_area id="your-sidebar-id"]
function my_widget_area_shortcode( $atts ) {
     ob_start();
     dynamic_sidebar( $atts['id'] );
     return ob_get_clean();
}
add_shortcode('widget_area', 'my_widget_area_shortcode');

http://codex.wordpress.org/Function_Reference/add_shortcode

http://codex.wordpress.org/Function_Reference/dynamic_sidebar