Advertisement
Guest User

price.php

a guest
Sep 22nd, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.04 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Loop Price
  4.  *
  5.  * This template can be overridden by copying it to yourtheme/woocommerce/loop/price.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     1.6.4
  16.  */
  17.  
  18. if ( ! defined( 'ABSPATH' ) ) {
  19.     exit; // Exit if accessed directly
  20. }
  21.  
  22. global $product;
  23.  
  24. ?>
  25.  
  26. <?php
  27. // Get the bottle size
  28.        
  29.        
  30. // Get the year
  31. $wine_year = get_post_meta( get_the_ID(), '_year_field', true );
  32. $year_field_label = _get_field('gg_store_year_field_label', 'option', esc_html__( 'Year', 'villenoir' ) );
  33. //Get the bottle
  34. $bottle_size_field_label = _get_field('gg_store_bottle_size_field_label', 'option', esc_html__( 'Bottle size', 'villenoir' ) );
  35. $bottle_size = get_post_meta( get_the_ID(), '_bottle_size_field', true );
  36.  
  37. //Check if year field is hidden from the theme options
  38. if ( _get_field('gg_store_year_field','option', true) !== true ) {
  39.     $wine_year = false;
  40. }
  41. //Check if bottle size field is hidden from the theme options
  42. if ( _get_field('gg_store_bottle_size_field','option', true) !== true ) {
  43.     $bottle_size = false;
  44. }
  45. // Get the shop style
  46. $shop_style = _get_field('gg_shop_product_style','option', 'style1');
  47.  
  48. if ( isset( $_GET['shop_style'] ) ) {
  49.    $shop_style = $_GET['shop_style'];
  50. }
  51.  
  52. ?>
  53.  
  54. <?php if ( $shop_style == 'style1' ) : ?>
  55. <dl>
  56.     <?php if ( $wine_year ) : ?>
  57.     <dt>
  58.         <?php echo esc_html($year_field_label); ?>
  59.     </dt>
  60.     <dd>
  61.         <span class="year"><?php echo esc_html($wine_year); ?></span>
  62.     </dd>
  63.     <?php endif; ?>
  64.  
  65.     <?php if ( $bottle_size ) : ?>
  66.     <dt>
  67.         <?php echo esc_html($bottle_size_field_label); ?>
  68.     </dt>
  69.     <dd>
  70.         <span class="year"><?php echo esc_html($bottle_size); ?></span>
  71.     </dd>
  72.     <?php endif; ?>
  73.  
  74.     <?php if ( $price_html = $product->get_price_html() ) : ?>
  75.     <dt>
  76.         <?php esc_html_e('Price','woocommerce'); ?>
  77.     </dt>
  78.     <dd>
  79.         <span class="price"><?php echo $price_html; ?></span>
  80.     </dd>
  81.     <?php endif; ?>
  82. </dl>
  83. <?php elseif ( $shop_style == 'style2' ) : ?>
  84. <dl>
  85.     <?php if ( $wine_year ) : ?>
  86.     <dt>
  87.         <span class="year"><?php echo esc_html($wine_year); ?></span>
  88.     </dt>
  89.     <?php endif; ?>
  90.  
  91.     <?php if ( $price_html = $product->get_price_html() ) : ?>
  92.     <dd>
  93.         <span class="price"><?php echo $price_html; ?></span>
  94.     </dd>
  95.     <?php endif; ?>
  96. </dl>
  97. <?php elseif ( $shop_style == 'style3' ) : ?>
  98.     <?php if ( $price_html = $product->get_price_html() ) : ?>
  99.         <span class="price"><?php echo $price_html; ?></span>
  100.     <?php endif; ?>
  101. <?php else: ?>
  102.     <?php if ( $price_html = $product->get_price_html() ) : ?>
  103.         <span class="price"><?php echo $price_html; ?></span>
  104.     <?php endif; ?>
  105. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement