I'm trying to add a sidebar to woocommerce woocommerce_before_shop_loop hook. I'm using the following code in the functions.php file:
add_action( 'woocommerce_before_shop_loop', 'my_custom_before_shop_loop_sidebar', 1); function my_custom_before_shop_loop_sidebar() { echo get_sidebar('my_custom_sidebar'); } The problem that I got is that it displays the wordpress default sidebar instead of the sidebar with the my_custom_sidebar id.
is there a way to accomplish this? thanks!
Ah by the way, I'm registering the sidebar like this :
/** * Register sidebars */ function meir_widgets_init() { register_sidebar( array( 'name' => 'My Custom Sidebar', 'id' => 'my_custom_sidebar', 'description' => 'Sidebar for top filters.', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '<div class="clear"></div></div></div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3><div class="filter_box"><div class="filter_wrapper">', ) ); } add_action( 'widgets_init', 'meir_widgets_init' );
'my_custom_sidebar'is not being registered properly. Additional code would help.