/templates/single-product/product-thumbnails.php
PHP | 45 lines | 24 code | 14 blank | 7 comment | 9 complexity | 15d7595e07b23d4bf227af078bffb3d7 MD5 | raw file
Possible License(s): GPL-3.0
- <?php
- /**
- * Single Product Thumbnails
- *
- * @author WooThemes
- * @package WooCommerce/Templates
- * @version 1.6.4
- */
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
- global $post, $product, $woocommerce;
- $attachment_ids = $product->get_gallery_attachment_ids();
- if ( $attachment_ids ) {
- ?>
- <div class="thumbnails"><?php
- $loop = 0;
- $columns = apply_filters( 'woocommerce_product_thumbnails_columns', 3 );
- foreach ( $attachment_ids as $id ) {
- $classes = array( 'zoom' );
- if ( $loop == 0 || $loop % $columns == 0 )
- $classes[] = 'first';
- if ( ( $loop + 1 ) % $columns == 0 )
- $classes[] = 'last';
- $attachment_url = wp_get_attachment_url( $id );
- if ( ! $attachment_url )
- continue;
- printf( '<a href="%s" title="%s" rel="prettyPhoto[product-gallery]" class="%s">%s</a>', esc_attr( $attachment_url ), esc_attr( get_the_title( $id ) ), implode( ' ', $classes ), wp_get_attachment_image( $id, apply_filters( 'single_product_small_thumbnail_size', 'shop_thumbnail' ) ) );
- $loop++;
- }
- ?></div>
- <?php
- }