product-thumbnails.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  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://docs.woocommerce.com/document/template-structure/
  14. * @author WooThemes
  15. * @package WooCommerce/Templates
  16. * @version 3.3.2
  17. */
  18. defined( 'ABSPATH' ) || exit;
  19. // 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.
  20. if ( ! function_exists( 'wc_get_gallery_image_html' ) ) {
  21. return;
  22. }
  23. global $product;
  24. $attachment_ids = $product->get_gallery_image_ids();
  25. if ( $attachment_ids && has_post_thumbnail() ) {
  26. foreach ( $attachment_ids as $attachment_id ) {
  27. echo apply_filters( 'woocommerce_single_product_image_thumbnail_html', wc_get_gallery_image_html( $attachment_id ), $attachment_id );
  28. }
  29. }