Created
December 10, 2013 11:35
-
-
Save dompascal/7889296 to your computer and use it in GitHub Desktop.
Woocommerce - Product Thumbnails Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Single Product Thumbnails | |
* | |
* @author WooThemes | |
* @package WooCommerce/Templates | |
* @version 2.0.3 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly | |
global $post, $product, $woocommerce; | |
$attachment_ids = $product->get_gallery_attachment_ids(); | |
?> | |
<?php foreach ( $attachment_ids as $attachment_id ): ?> | |
<a id="<?php echo $attachment_id; ?>" href="<?php $image = wp_get_attachment_image_src( $attachment_id, 'large'); ?><?php echo $image[0]; ?>" rev="<?php $image = wp_get_attachment_image_src( $attachment_id, 'product-zoom'); ?><?php echo $image[0]; ?>" rel="zoom-id:zoom;selectors-effect-speed:100;" class="selector"> | |
<?php $image = wp_get_attachment_image_src( $attachment_id, 'shop_thumbnail'); ?> | |
<img src="<?php echo $image[0]; ?>"> | |
</a> | |
<?php endforeach; ?> | |
<!-- view larger btn --> | |
<a class="view-larger fancybox" href="<?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?>"> | |
View Larger | |
</a> | |
<!-- end view larger btn --> | |
<script type="text/javascript"> | |
$(function(){ | |
$('a#<?php the_ID(); ?>').click(function() { | |
$("a.view-larger").attr("href", "<?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?>"); | |
}); | |
<?php foreach ( $attachment_ids as $attachment_id ): ?> | |
<?php $image = wp_get_attachment_image_src( $attachment_id, 'large'); ?> | |
$('a#<?php echo $attachment_id; ?>').click(function() { | |
$("a.view-larger").attr("href", "<?php echo $image[0]; ?>"); | |
}); | |
<?php endforeach; ?> | |
}); | |
</script> | |
<?php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment