add-to-cart
1 month ago
tabs
1 year ago
back-in-stock-form.php
10 months ago
meta.php
1 year ago
photoswipe.php
10 months ago
price.php
2 years ago
product-attributes.php
1 year ago
product-image.php
5 months ago
product-thumbnails.php
1 year ago
rating.php
2 years ago
related.php
9 months ago
review-meta.php
2 years ago
review-rating.php
2 years ago
review.php
2 years ago
sale-flash.php
2 years ago
share.php
2 years ago
short-description.php
2 years ago
stock.php
2 years ago
title.php
2 years ago
up-sells.php
1 year ago
product-thumbnails.php
46 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Single Product Thumbnails |
| 4 | * |
| 5 | * This template can be overridden by copying it to yourtheme/woocommerce/single-product/product-thumbnails.php. |
| 6 | * |
| 7 | * HOWEVER, on occasion WooCommerce will need to update template files and you |
| 8 | * (the theme developer) will need to copy the new files to your theme to |
| 9 | * maintain compatibility. We try to do this as little as possible, but it does |
| 10 | * happen. When this occurs the version of the template file will be bumped and |
| 11 | * the readme will list any important changes. |
| 12 | * |
| 13 | * @see https://woocommerce.com/document/template-structure/ |
| 14 | * @package WooCommerce\Templates |
| 15 | * @version 9.8.0 |
| 16 | */ |
| 17 | |
| 18 | defined( 'ABSPATH' ) || exit; |
| 19 | |
| 20 | // Note: `wc_get_gallery_image_html` was added in WC 3.3.2 and did not exist prior. This check protects against theme overrides being used on older versions of WC. |
| 21 | if ( ! function_exists( 'wc_get_gallery_image_html' ) ) { |
| 22 | return; |
| 23 | } |
| 24 | |
| 25 | global $product; |
| 26 | |
| 27 | if ( ! $product || ! $product instanceof WC_Product ) { |
| 28 | return ''; |
| 29 | } |
| 30 | |
| 31 | $attachment_ids = $product->get_gallery_image_ids(); |
| 32 | |
| 33 | if ( $attachment_ids && $product->get_image_id() ) { |
| 34 | foreach ( $attachment_ids as $key => $attachment_id ) { |
| 35 | /** |
| 36 | * Filter product image thumbnail HTML string. |
| 37 | * |
| 38 | * @since 1.6.4 |
| 39 | * |
| 40 | * @param string $html Product image thumbnail HTML string. |
| 41 | * @param int $attachment_id Attachment ID. |
| 42 | */ |
| 43 | echo apply_filters( 'woocommerce_single_product_image_thumbnail_html', wc_get_gallery_image_html( $attachment_id, false, $key ), $attachment_id ); // PHPCS:Ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 44 | } |
| 45 | } |
| 46 |