add_filter( 'generate_sidebar_layout','generate_custom_woocommerce_sidebar_layout' );
function generate_custom_woocommerce_sidebar_layout( $layout )
{
// If we are on a woocommerce page, set the sidebar
if ( is_woocommerce() )
return 'both-left';
// Or else, set the regular layout
return $layout;
}
In Customizing I set: Sidebar Layout – Content (No sidebars); Blog Sidebar Layout – Content (No sidebars); Single Post Sidebar Layout – Content (No sidebars).
It works, I don’t have any sidebars except shop-page, and I’d like to hide sidebar from product-page.
add_filter( 'generate_sidebar_layout','generate_custom_woocommerce_sidebar_layout' );
function generate_custom_woocommerce_sidebar_layout( $layout )
{
// If we are on a woocommerce page, set the sidebar
if ( is_woocommerce() && ! is_single() )
return 'both-left';
// Or else, set the regular layout
return $layout;
}
Fatal error: Cannot redeclare generate_custom_woocommerce_sidebar_layout() (previously declared in .../wp-content/themes/generatepress/functions.php:659) in .../themes/generatepress/functions.php on line 700
Ok, Tom, I added new buttons into a widget and it looks great. Now I don’t need in anymore.
Thanks for help π