Skip to content

Instantly share code, notes, and snippets.

@rynaldos-zz
Last active February 3, 2017 07:44
Show Gist options
  • Save rynaldos-zz/731ae11446d34339efc5da290ac4fbe5 to your computer and use it in GitHub Desktop.
Save rynaldos-zz/731ae11446d34339efc5da290ac4fbe5 to your computer and use it in GitHub Desktop.
[WooCommerce | Storefront] Hide the sidebar on all pages (except for the product page) and make content section full-width
// remove the sidebar everywhere except for products page
function remove_storefront_sidebar() {
if ( ! is_product() ) {
remove_action( 'storefront_sidebar', 'storefront_get_sidebar', 10 );
}
}
add_action( 'get_header', 'remove_storefront_sidebar' );
// make content full-width
function my_body_classes( $classes ) {
if ( ! is_product() ) {
$classes[] = 'storefront-full-width-content';
}
return $classes;
}
add_filter( 'body_class', 'my_body_classes' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment