From: Laury GvR Date: Wed, 28 Jun 2017 14:31:06 +0000 (-0400) Subject: Excluding woocommerce cats by slug instead of id. X-Git-Tag: v1.0.23^2~4 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=6fc8c7f5f994b00091e3cb6339494c80b04e599b;p=WP-Themes%2Fcapstone.git 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'. --- 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', );