Answer the question
In order to leave comments, you need to log in
How to create custom sidebar in woocommerce?
I don't know how to display my sidebar on woocommerce pages.
Registered sidebar in functions:
//второй сайдбар под шоп
function grad_market_widgets_init1() {
register_sidebar(
array(
'name' => esc_html__( 'Sidebar-shop', 'grad_market' ),
'id' => 'sidebar-2',
'description' => esc_html__( 'Add widgets here.', 'grad_market' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
)
);
}
add_action( 'widgets_init', 'grad_market_widgets_init1' );
<?
/**
* Hook: woocommerce_sidebar.
*
* @hooked woocommerce_get_sidebar - 10
*/
do_action( 'woocommerce_sidebar' ); ?>
Answer the question
In order to leave comments, you need to log in
// отключение сайдбара
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
add_action( 'woocommerce_sidebar', 'standart_sidebar', 10 );
function standart_sidebar() {
get_template_part( 'sidebar' );
//get_sidebar();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question