<?php
全局$product;
$attachment_ids = $product->get_gallery_attachment_ids();
foreach( $attachment_ids as $attachment_id )
{
获取图库图片的网址 – 默认wordpress图片大小
echo $Original_image_url = wp_get_attachment_url( $attachment_id );
echo $full_url = wp_get_attachment_image_src( $attachment_id, ‘full’ )[0];
echo $medium_url = wp_get_attachment_image_src( $attachment_id, ‘medium’ )[0];
echo $thumbnail_url = wp_get_attachment_image_src( $attachment_id, ‘thumbnail’ )[0];
获取图库图像的 URL – WooCommerce 特定的图像大小
echo $shop_thumbnail_image_url = wp_get_attachment_image_src( $attachment_id, ‘shop_thumbnail’ )[0];
回声 $shop_catalog_image_url = wp_get_attachment_image_src( $attachment_id, ‘shop_catalog’ )[0];
回声 $shop_single_image_url = wp_get_attachment_image_src( $attachment_id, ‘shop_single’ )[0];
echo Image 而不是 URL
echo wp_get_attachment_image($attachment_id, ‘full’);
echo wp_get_attachment_image($attachment_id, ‘medium’);
echo wp_get_attachment_image($attachment_id, ‘缩略图’);
回声 wp_get_attachment_image($attachment_id, ‘shop_thumbnail’);
回声 wp_get_attachment_image($attachment_id, ‘shop_catalog’);
回声 wp_get_attachment_image($attachment_id, ‘shop_single’);
}
?>