wc_get_product_gallery_html()
Get HTML for a complete product gallery.
Delegates to the single-product/product-image.php template so themes that override that template are honored, and so any extensions hooked on woocommerce_product_thumbnails woocommerce_single_product_image_thumbnail_html fire on variation gallery swaps.
Хуков нет.
Возвращает
string.
Использование
wc_get_product_gallery_html( $product, $image_ids );
- $product(WC_Product) (обязательный)
- Product used for gallery context.
- $image_ids(массив|null)
- Ordered image IDs to render. When null, the template renders the product's own featured image and gallery; otherwise the supplied IDs are presented to the template as if they were the product's own images (the first ID becomes the featured slot, the rest the gallery).
По умолчанию:null
Список изменений
| С версии 10.8.0 | Введена. |
Код wc_get_product_gallery_html() wc get product gallery html WC 11.2.2
function wc_get_product_gallery_html( $product, $image_ids = null ) {
if ( ! $product instanceof WC_Product ) {
return '';
}
if ( null === $image_ids ) {
return wc_render_product_image_template_for( $product );
}
return wc_render_product_image_template_for_image_ids( $product, $image_ids );
}