get_gallery_image_ids(); $post_thumbnail_id = (int)$product->get_image_id(); array_unshift($attachment_ids, $post_thumbnail_id); add_filter('woocommerce_single_product_image_thumbnail_html', 'attire_get_gallery_image_html', 10, 2); function attire_get_gallery_image_html($main_image, $attachment_id) { $flexslider = (bool)apply_filters('woocommerce_single_product_flexslider_enabled', get_theme_support('wc-product-gallery-slider')); $gallery_thumbnail = wc_get_image_size('gallery_thumbnail'); $thumbnail_size = apply_filters('woocommerce_gallery_thumbnail_size', array($gallery_thumbnail['width'], $gallery_thumbnail['height'])); $image_size = apply_filters('woocommerce_gallery_image_size', $flexslider || $main_image ? 'woocommerce_single' : $thumbnail_size); $full_size = apply_filters('woocommerce_gallery_full_size', apply_filters('woocommerce_product_thumbnails_large_size', 'full')); $thumbnail_src = wp_get_attachment_image_src($attachment_id, $thumbnail_size); $full_src = wp_get_attachment_image_src($attachment_id, $full_size); $alt_text = trim(wp_strip_all_tags(get_post_meta($attachment_id, '_wp_attachment_image_alt', true))); $image = wp_get_attachment_image( $attachment_id, $image_size, false, apply_filters( 'woocommerce_gallery_image_html_attachment_image_params', array( 'title' => _wp_specialchars(get_post_field('post_title', $attachment_id), ENT_QUOTES, 'UTF-8', true), 'data-caption' => _wp_specialchars(get_post_field('post_excerpt', $attachment_id), ENT_QUOTES, 'UTF-8', true), 'data-src' => esc_url($full_src[0]), 'data-large_image' => esc_url($full_src[0]), 'data-large_image_width' => esc_attr($full_src[1]), 'data-large_image_height' => esc_attr($full_src[2]), 'class' => esc_attr($main_image ? 'wp-post-image' : ''), ), $attachment_id, $image_size, $main_image ) ); return '