Advertisement
deliciousthemes

Content Product WooCommerce page for Sympathique theme

Jan 28th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.98 KB | None | 0 0
  1. <?php
  2. /**
  3.  * The template for displaying product content within loops
  4.  *
  5.  * This template can be overridden by copying it to yourtheme/woocommerce/content-product.php.
  6.  *
  7.  * HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer).
  8.  * will need to copy the new files to your theme to maintain compatibility. We try to do this.
  9.  * as little as possible, but it does happen. When this occurs the version of the template file will.
  10.  * be bumped and the readme will list any important changes.
  11.  *
  12.  * @see     http://docs.woothemes.com/document/template-structure/
  13.  * @author  WooThemes
  14.  * @package WooCommerce/Templates
  15.  * @version 2.5.0
  16.  */
  17.  
  18. if ( ! defined( 'ABSPATH' ) ) {
  19.     exit; // Exit if accessed directly
  20. }
  21.  
  22. global $product, $woocommerce_loop;
  23.  
  24. // Store loop count we're currently on
  25. if ( empty( $woocommerce_loop['loop'] ) ) {
  26.     $woocommerce_loop['loop'] = 0;
  27. }
  28.  
  29.  
  30. // Store column count for displaying the grid
  31. if ( empty( $woocommerce_loop['columns'] ) ) {
  32.     $woocommerce_loop['columns'] = apply_filters( 'loop_shop_columns', $smof_data["woo_products_per_row"] );
  33. }
  34.  
  35. // Ensure visibility
  36. if ( ! $product || ! $product->is_visible() ) {
  37.     return;
  38. }
  39.  
  40. // Increase loop count
  41. $woocommerce_loop['loop']++;
  42.  
  43. // Extra post classes
  44. $classes = array();
  45. if ( 0 === ( $woocommerce_loop['loop'] - 1 ) % $woocommerce_loop['columns'] || 1 === $woocommerce_loop['columns'] ) {
  46.     $classes[] = 'first';
  47. }
  48. if ( 0 === $woocommerce_loop['loop'] % $woocommerce_loop['columns'] ) {
  49.     $classes[] = 'last';
  50. }
  51.  
  52. switch ($smof_data["woo_products_per_row"]) {
  53.     case '2':
  54.         $classes[] = 'percent-one-half';
  55.         break;
  56.     case '3':
  57.         $classes[] = 'percent-one-third';
  58.         break;
  59.     case '4':
  60.         $classes[] = 'percent-one-fourth';
  61.         break;
  62.     case '5':
  63.         $classes[] = 'percent-one-fifth';
  64.         break;     
  65.     case '6':
  66.         $classes[] = 'percent-one-sixth';
  67.         break; 
  68. }
  69.  
  70. ?>
  71. <li <?php post_class( $classes ); ?>>
  72.  
  73.     <?php
  74.     /**
  75.      * woocommerce_before_shop_loop_item hook.
  76.      *
  77.      * @hooked woocommerce_template_loop_product_link_open - 10
  78.      */
  79.     do_action( 'woocommerce_before_shop_loop_item' );
  80.  
  81.     /**
  82.      * woocommerce_before_shop_loop_item_title hook.
  83.      *
  84.      * @hooked woocommerce_show_product_loop_sale_flash - 10
  85.      * @hooked woocommerce_template_loop_product_thumbnail - 10
  86.      */
  87.     do_action( 'woocommerce_before_shop_loop_item_title' );
  88.  
  89.     /**
  90.      * woocommerce_shop_loop_item_title hook.
  91.      *
  92.      * @hooked woocommerce_template_loop_product_title - 10
  93.      */
  94.     do_action( 'woocommerce_shop_loop_item_title' );
  95.  
  96.     /**
  97.      * woocommerce_after_shop_loop_item_title hook.
  98.      *
  99.      * @hooked woocommerce_template_loop_rating - 5
  100.      * @hooked woocommerce_template_loop_price - 10
  101.      */
  102.     do_action( 'woocommerce_after_shop_loop_item_title' );
  103.  
  104.     /**
  105.      * woocommerce_after_shop_loop_item hook.
  106.      *
  107.      * @hooked woocommerce_template_loop_product_link_close - 5
  108.      * @hooked woocommerce_template_loop_add_to_cart - 10
  109.      */
  110.     do_action( 'woocommerce_after_shop_loop_item' );
  111.     ?>
  112.  
  113. </li>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement