Advertisement
Guest User

Untitled

a guest
Sep 4th, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.56 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Single Product Image
  4.  *
  5.  * @author      WooThemes
  6.  * @package     WooCommerce/Templates
  7.  * @version     2.0.3
  8.  */
  9.  
  10. if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
  11.  
  12. global $post, $woocommerce, $product;
  13.  
  14. ?>
  15. <div class="images">
  16.  
  17.     <?php
  18.         if ( has_post_thumbnail() ) {
  19.  
  20.             $image              = get_the_post_thumbnail( $post->ID, apply_filters( 'single_product_large_thumbnail_size', 'shop_single' ) );
  21.             $image_title        = esc_attr( get_the_title( get_post_thumbnail_id() ) );
  22.             $image_link         = wp_get_attachment_url( get_post_thumbnail_id() );
  23.             $attachment_count   = count( $product->get_gallery_attachment_ids() );
  24.  
  25.             if ( $attachment_count > 0 ) {
  26.                 $gallery = '[product-gallery]';
  27.             } else {
  28.                 $gallery = '';
  29.             }
  30.  
  31. add_filter( 'single_product_large_thumbnail_size', 'wc_single_product_size' );
  32. function wc_single_product_size(){
  33.     return 'full';
  34. }
  35.  
  36. add_filter( 'woocommerce_single_product_image_html', 'wc_remove_product_image_url' );
  37. function wc_remove_product_image_url( $html ){
  38.     return strip_tags( $html, '<img>');
  39. }
  40.             echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<a href="%s" itemprop="image" class="woocommerce-main-image zoom" title="%s"  rel="prettyPhoto' . $gallery . '">%s</a>', $image_link, $image_title, $image ), $post->ID );
  41.  
  42.         } else {
  43.  
  44.             echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<img src="%s" alt="Placeholder" />', woocommerce_placeholder_img_src() ), $post->ID );
  45.  
  46.         }
  47.     ?>
  48.  
  49.     <?php do_action( 'woocommerce_product_thumbnails' ); ?>
  50.  
  51. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement