Skip to content

Instantly share code, notes, and snippets.

@DxDiagDx
Last active April 22, 2022 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DxDiagDx/5c77a0afbbbd9b9c8ab006a7b1ed2921 to your computer and use it in GitHub Desktop.
Save DxDiagDx/5c77a0afbbbd9b9c8ab006a7b1ed2921 to your computer and use it in GitHub Desktop.
Woo: Скрыть сайдбар в категориях первого уровня
/* Скрыть сайдбар в категориях первого уровня */
add_action( 'get_header', 'remove_storefront_sidebar' );
function remove_storefront_sidebar() {
if (is_product_category() ) {
global $wp_query;
$cat_obj = $wp_query->get_queried_object();
$category_parent = $cat_obj->parent;
if ( $category_parent == 0) {
remove_action( 'storefront_sidebar', 'storefront_get_sidebar', 10 );
?>
<style>
#primary {
width: 100%;
}
</style>
<?php
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment