shortcode – wpv-dynamic-sidebar

Sometimes it is useful to include WordPress Sidebar in a Content Template or a View. It is possible to build a shortcode to display it:

// Display WP Sidebar shortcode 
add_shortcode('wpv-dynamic-sidebar', 'my_sidebar_shortcode');
function my_sidebar_shortcode($atts) {
  $a = shortcode_atts( array(
    'sidebar' => 'sidebar-1',
  ), $atts );
  return ob_get_clean();

dynamic_sidebar() reference:

Then I can use this shortcode anywhere:


By default this displays the default sidebar or ‘sidebar-1’. It is also possible to pass another sidebar name by the attribute “sidebar”. For example:

[wpv-dynamic-sidebar sidebar="footer-1"]

You can find this solution on this Toolset forum thread: