Advertising
- custom_product-cat
- Thursday, December 20th, 2012 at 4:32:54am MST
- <?php if($category->count == 1){
- $query_args = array( 'showposts'=>1,'post_status' => 'publish', 'post_type' => 'product', 'tax_query' => array(
- array(
- 'taxonomy' => 'product_cat',
- 'field' => 'slug',
- 'terms' => $category
- )));
- $r = new WP_Query($query_args);
- if ($r->have_posts()) {
- ?>
- <?php while ($r->have_posts()) : $r->the_post(); global $product;
- $category_link = get_permalink() ;
- endwhile; ?>
- <?php
- // Reset the global $the_post as this query will have stomped on it
- wp_reset_query();
- } else {$category_link = $category_link = get_term_link( $category->slug, 'product_cat' );}
- }else{$category_link = get_term_link( $category->slug, 'product_cat' );}?>
- <?php
- /**
- * The template for displaying product category thumbnails within loops.
- *
- * Override this template by copying it to yourtheme/woocommerce/content-product_cat.php
- *
- * @package WooCommerce
- * @since WooCommerce 1.6
- */
- global $woocommerce_loop;
- // 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'] = of_get_option('shop_cols');
- // Increase loop count
- $woocommerce_loop['loop']++;
- ?>
- <div class="grid<?php echo of_get_option('shop_cols', '3'); ?>column <?php
- if ( $woocommerce_loop['loop'] % $woocommerce_loop['columns'] == 0 )
- echo 'lastcolumn';
- elseif ( ( $woocommerce_loop['loop'] - 1 ) % $woocommerce_loop['columns'] == 0 )
- echo 'first';
- ?>">
- <?php do_action( 'woocommerce_before_subcategory', $category ); ?>
- <div class="item-container shop-item-zoom">
- <div class="item-container-image item-container-spacer">
- <?php if(of_get_option('hover_icon_display_shop', 'yes') == 'yes'): ?>
- <a href="<?php echo $category_link; ?>" class="zoom-icon zoom-icon-article"></a>
- <?php endif; ?>
- <a href="<?php echo $category_link; ?>">
- <?php
- /**
- * woocommerce_before_subcategory_title2 hook
- *
- * @hooked woocommerce_subcategory_thumbnail2 - 10
- */
- do_action( 'woocommerce_before_subcategory_title2', $category );
- ?>
- </a>
- </div>
- <div class="item-container-content">
- <h4 class="aligncenter">
- <a href="<?php echo $category_link; ?>">
- <?php echo $category->name; ?>
- <?php if ( $category->count > 0 ) : ?>
- <mark class="count">(<?php echo $category_link; ?>)</mark>
- <?php endif; ?>
- </a>
- </h4>
- <div class="aligncenter description-index"><div itemprop="description">
- <?php echo $category->description; ?></div></div>
- <div class="aligncenter">
- <a href="<?php echo $category_link; ?>" class="def-button arrow-button category-button"><?php _e('View Category','woocommerce'); ?></a>
- </div>
- <?php
- /**
- * woocommerce_after_subcategory_title hook
- */
- do_action( 'woocommerce_after_subcategory_title', $category );
- ?>
- </div><!-- close .item-container-content -->
- </div><!-- close .item-container -->
- </div>
- <?php
- if ( $woocommerce_loop['loop'] % $woocommerce_loop['columns'] == 0 )
- echo '<div class="clearfix"></div><br>';
- elseif ( ( $woocommerce_loop['loop'] - 1 ) % $woocommerce_loop['columns'] == 0 )
- echo '';
- ?>
- <?php do_action( 'woocommerce_after_subcategory', $category ); ?>
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.