From 6fc8c7f5f994b00091e3cb6339494c80b04e599b Mon Sep 17 00:00:00 2001 From: Laury GvR Date: Wed, 28 Jun 2017 10:31:06 -0400 Subject: [PATCH] Excluding woocommerce cats by slug instead of id. Excluding the categories on the frontpage and sidebar by ID resulted in these not being excluded on local and development copies. Using the slug fixes this as they're all referred to as 'Whitepages'. --- parts/shop-cats-and-products.php | 11 +++++++---- sections/front-page.php | 7 +++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/parts/shop-cats-and-products.php b/parts/shop-cats-and-products.php index 3c8e0d8..385d7ea 100644 --- a/parts/shop-cats-and-products.php +++ b/parts/shop-cats-and-products.php @@ -1,11 +1,14 @@ -term_id; + $args = array( 'orderby' => 'title', 'order' => 'ASC', 'hide_empty' => false, - 'exclude' => '18' - + 'exclude' => $excluded_cat_id + ); $product_categories = get_terms( 'product_cat', $args ); $count = count($product_categories); @@ -36,7 +39,7 @@ $products = new WP_Query( $args ); if ($products->have_posts()) { ?>
- '; echo '' . $product_category->name . ''; echo '
'; diff --git a/sections/front-page.php b/sections/front-page.php index 8e84e13..d749f22 100644 --- a/sections/front-page.php +++ b/sections/front-page.php @@ -34,9 +34,12 @@
- term_id; + $args = array( 'hide_empty' => false, - 'exclude' => '18', + 'exclude' => $excluded_cat_id, 'orderby' => 'menu_order', 'order' => 'ASC', ); -- 2.17.1