kriskhoury
11/20/2019 - 4:54 PM

WP Sidebar to Shortcode

add_shortcode('get_sidebar', '_sidebar_shortcode' );
function uad_sidebar_shortcode($atts, $content="null"){
  extract(shortcode_atts(array('name' => ''), $atts));

  ob_start();
  get_sidebar($name);
  $sidebar= ob_get_contents();
  ob_end_clean();

  return $sidebar;
}