Hi guys, i read many topics regarding this but some were outdated. hoping to get some latest update π
Loving GP !
the case is i need a custom sidebar for my woocommerce and all its related pages. i tried few sidebar and widget plugins but nothing works with woocomerce.
so i assume now my only solution is to register a sidebar and add it as snippet .
1. register sidebar , is this the code ? ps mysidebar name is Shop-Sidebar
function arphabet_widgets_init() {
register_sidebar( array(
'name' => 'Shop-Sidebar',
'id' => 'shop-sidebar',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h4>',
'after_title' => '</h4>',
) );
}
add_action( 'widgets_init', 'arphabet_widgets_init' );
add_action('generate_woocommerce_sidebars','generate_contsruct_sidebars');
function generate_contsruct_sidebars()
{
get_sidebar('Shop-Sidebar');
}
2. call in sidebar for wc
add_action( 'wp','tu_woocommerce_sidebar' );
function tu_woocommerce_sidebar()
{
if ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) {
remove_action( 'generate_sidebars','generate_construct_sidebars' );
add_action( 'generate_sidebars','tu_construct_woocommerce_sidebar' );
}
}
function tu_construct_woocommerce_sidebar() {
get_sidebar( 'Shop-Sidebar' );
}
i know somewherer is wrong , pls correct me , thanks !
GeneratePress 2.0.2
GP Premium 1.6.2