Merge pull request #21416 from pierrebuet/master
Show the right size of placeholder image on single product page
This commit is contained in:
commit
b424213554
|
@ -284,8 +284,7 @@ function wc_placeholder_img_src( $size = 'woocommerce_thumbnail' ) {
|
||||||
|
|
||||||
if ( ! empty( $placeholder_image ) ) {
|
if ( ! empty( $placeholder_image ) ) {
|
||||||
if ( is_numeric( $placeholder_image ) ) {
|
if ( is_numeric( $placeholder_image ) ) {
|
||||||
$dimensions = wc_get_image_size( $size );
|
$image = wp_get_attachment_image_src( $placeholder_image, $size );
|
||||||
$image = wp_get_attachment_image_src( $placeholder_image, array( $dimensions['width'], $dimensions['height'] ) );
|
|
||||||
|
|
||||||
if ( ! empty( $image[0] ) ) {
|
if ( ! empty( $image[0] ) ) {
|
||||||
$src = $image[0];
|
$src = $image[0];
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
* @see https://docs.woocommerce.com/document/template-structure/
|
* @see https://docs.woocommerce.com/document/template-structure/
|
||||||
* @author WooThemes
|
* @author WooThemes
|
||||||
* @package WooCommerce/Templates
|
* @package WooCommerce/Templates
|
||||||
* @version 3.3.2
|
* @version 3.5.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
@ -41,7 +41,7 @@ $wrapper_classes = apply_filters( 'woocommerce_single_product_image_gallery_cl
|
||||||
$html = wc_get_gallery_image_html( $post_thumbnail_id, true );
|
$html = wc_get_gallery_image_html( $post_thumbnail_id, true );
|
||||||
} else {
|
} else {
|
||||||
$html = '<div class="woocommerce-product-gallery__image--placeholder">';
|
$html = '<div class="woocommerce-product-gallery__image--placeholder">';
|
||||||
$html .= sprintf( '<img src="%s" alt="%s" class="wp-post-image" />', esc_url( wc_placeholder_img_src() ), esc_html__( 'Awaiting product image', 'woocommerce' ) );
|
$html .= sprintf( '<img src="%s" alt="%s" class="wp-post-image" />', esc_url( wc_placeholder_img_src( 'woocommerce_single' ) ), esc_html__( 'Awaiting product image', 'woocommerce' ) );
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue