Skip to content

Instantly share code, notes, and snippets.

@dompascal
Created December 6, 2013 14:28
Show Gist options
  • Save dompascal/7825601 to your computer and use it in GitHub Desktop.
Save dompascal/7825601 to your computer and use it in GitHub Desktop.
Woocommerce - Single Product Image Template
<?php
/**
* Single Product Image
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.0.3
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
global $post, $woocommerce, $product;
?>
<!-- main img -->
<div class="main-img">
<?php if(has_post_thumbnail()) { ?>
<a href="<?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?>" class="MagicZoom" id="zoom" class="active" rel="selectors-class: active;">
<?php the_post_thumbnail('product-zoom');?>
</a>
<?php } else { ?>
<img src="<?php echo home_url( '/' ); ?>wp-content/plugins/woocommerce/assets/images/placeholder.png" width="390" alt="Image Unavailable" />
<?php } ?>
<!-- zoom label -->
<div class="zoom">
<span class="text">HOVER IMAGE TO ZOOM IN<span class="icon"></span></span>
</div>
<!-- end zoom label -->
</div>
<!-- end main img -->
<!-- thumbnails -->
<section class="thumbnails">
<!-- thumb from featured img -->
<?php if(has_post_thumbnail()) { ?>
<a id="<?php the_ID(); ?>" class="active" href="<?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?>" rev="<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'product-zoom'); ?><?php echo $image[0]; ?>" rel="zoom-id:zoom;selectors-effect-speed:100;" class="selector">
<?php the_post_thumbnail('shop_thumbnail');?>
</a>
<?php echo $attachment_id; ?>
<?php } ?>
<!-- end thumb from featured img -->
<!-- thumbs from product gallery field -->
<?php do_action( 'woocommerce_product_thumbnails' ); ?>
<!-- end thumbs from product gallery field -->
</section>
<!-- end thumbnails -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment