woocommerce_get_product_thumbnail()
Get the product thumbnail, or the placeholder if not set.
Хуки из функции
Возвращает
Строку.
Использование
woocommerce_get_product_thumbnail( $size, $attr, $placeholder );
- $size(строка)
- .
По умолчанию:'woocommerce_thumbnail' - $attr(массив)
- Image attributes.
По умолчанию:array() - $placeholder(true|false)
- True to return
$placeholderif no image is found, or false to return an empty string.
По умолчанию:true
Код woocommerce_get_product_thumbnail() woocommerce get product thumbnail WC 10.5.2
function woocommerce_get_product_thumbnail( $size = 'woocommerce_thumbnail', $attr = array(), $placeholder = true ) {
global $product;
if ( ! ( $product instanceof WC_Product ) ) {
return '';
}
if ( ! is_array( $attr ) ) {
$attr = array();
}
if ( ! is_bool( $placeholder ) ) {
$placeholder = true;
}
$image_size = apply_filters( 'single_product_archive_thumbnail_size', $size );
return $product->get_image( $image_size, $attr, $placeholder );
}