Changeset 1728010
- Timestamp:
- 09/11/2017 11:27:23 AM (9 years ago)
- Location:
- wc-qr-codes
- Files:
-
- 2 edited
-
tags/1.0.5/includes/class-wc-qr-codes-shortcodes.php (modified) (2 diffs)
-
trunk/includes/class-wc-qr-codes-shortcodes.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wc-qr-codes/tags/1.0.5/includes/class-wc-qr-codes-shortcodes.php
r1727953 r1728010 23 23 24 24 public static function wc_qr_code($atts) { 25 global $product; 25 26 $default = array( 26 27 'id' => '', … … 28 29 ); 29 30 $atts = shortcode_atts($default, $atts, 'wc_qr_code'); 30 $product = wc_get_product($atts['id']);31 $product_obj = wc_get_product($atts['id']) ? wc_get_product($atts['id']) : $product; 31 32 if($atts['title']){ 32 33 echo '<h2 class="wc-qr-codes-h2">'.$atts['title'].'</h2>'; 33 34 } 34 if ($product && get_wc_product_qr_code_src($product ->get_id())) {35 if ($product && get_wc_product_qr_code_src($product_obj->get_id())) { 35 36 echo '<div class="wc-qr-codes-container">'; 36 echo '<img class="wcqrc-qr-code-img" src="' . get_wc_product_qr_code_src($product ->get_id()) . '" alt="QR Code" />';37 echo '<img class="wcqrc-qr-code-img" src="' . get_wc_product_qr_code_src($product_obj->get_id()) . '" alt="QR Code" />'; 37 38 echo '</div>'; 38 39 } -
wc-qr-codes/trunk/includes/class-wc-qr-codes-shortcodes.php
r1727953 r1728010 23 23 24 24 public static function wc_qr_code($atts) { 25 global $product; 25 26 $default = array( 26 27 'id' => '', … … 28 29 ); 29 30 $atts = shortcode_atts($default, $atts, 'wc_qr_code'); 30 $product = wc_get_product($atts['id']);31 $product_obj = wc_get_product($atts['id']) ? wc_get_product($atts['id']) : $product; 31 32 if($atts['title']){ 32 33 echo '<h2 class="wc-qr-codes-h2">'.$atts['title'].'</h2>'; 33 34 } 34 if ($product && get_wc_product_qr_code_src($product ->get_id())) {35 if ($product && get_wc_product_qr_code_src($product_obj->get_id())) { 35 36 echo '<div class="wc-qr-codes-container">'; 36 echo '<img class="wcqrc-qr-code-img" src="' . get_wc_product_qr_code_src($product ->get_id()) . '" alt="QR Code" />';37 echo '<img class="wcqrc-qr-code-img" src="' . get_wc_product_qr_code_src($product_obj->get_id()) . '" alt="QR Code" />'; 37 38 echo '</div>'; 38 39 }
Note: See TracChangeset
for help on using the changeset viewer.