Woocommerce Styles 2
authorLaury GvR <laury@gaslightmedia.com>
Tue, 16 Jun 2015 19:14:08 +0000 (15:14 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Tue, 16 Jun 2015 19:14:08 +0000 (15:14 -0400)
woocommerce/content-product_cat.php [new file with mode: 0644]

diff --git a/woocommerce/content-product_cat.php b/woocommerce/content-product_cat.php
new file mode 100644 (file)
index 0000000..5101167
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+/**
+ * The template for displaying product category thumbnails within loops.
+ *
+ * Override this template by copying it to yourtheme/woocommerce/content-product_cat.php
+ *
+ * @author             WooThemes
+ * @package    WooCommerce/Templates
+ * @version     1.6.4
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+       exit; // Exit if accessed directly
+}
+
+global $woocommerce_loop;
+
+
+/* 
+ *     Exclude certain categories - Chuck Scott - 5/28/15
+ *     Enter the slug of a category to exclude in the 
+ &     $excludeCats array below.
+*/
+$excludeCats = array(
+       'souvenir'
+);
+if ( is_shop() && in_array( $category->slug, $excludeCats ) ) {
+       return;
+}
+
+
+// Store loop count we're currently on
+if ( empty( $woocommerce_loop['loop'] ) )
+       $woocommerce_loop['loop'] = 0;
+
+// Store column count for displaying the grid
+if ( empty( $woocommerce_loop['columns'] ) )
+       $woocommerce_loop['columns'] = apply_filters( 'loop_shop_columns', 4 );
+
+// Increase loop count
+$woocommerce_loop['loop']++;
+?>
+
+
+<?php if ( $category->count > 0 ) { ?>
+<li class="product-category product<?php
+    if ( ( $woocommerce_loop['loop'] - 1 ) % $woocommerce_loop['columns'] == 0 || $woocommerce_loop['columns'] == 1 )
+        echo ' first';
+       if ( $woocommerce_loop['loop'] % $woocommerce_loop['columns'] == 0 )
+               echo ' last';
+       ?>">
+
+       <?php do_action( 'woocommerce_before_subcategory', $category ); ?>
+
+       <a href="<?php echo get_term_link( $category->slug, 'product_cat' ); ?>">
+
+               <?php
+                       /**
+                        * woocommerce_before_subcategory_title hook
+                        *
+                        * @hooked woocommerce_subcategory_thumbnail - 10
+                        */
+                       do_action( 'woocommerce_before_subcategory_title', $category );
+               ?>
+
+               <h3>
+                       <?php
+                               echo $category->name;
+                       ?>
+               </h3>
+
+               <?php
+                       /**
+                        * woocommerce_after_subcategory_title hook
+                        */
+                       do_action( 'woocommerce_after_subcategory_title', $category );
+               ?>
+
+       </a>
+
+       <?php do_action( 'woocommerce_after_subcategory', $category ); ?>
+
+</li>
+<?php } ?>