Add srcset handling
This commit is contained in:
parent
847d5b680d
commit
08a76e1eea
|
@ -457,6 +457,10 @@ add_action( 'woocommerce_scheduled_sales', 'wc_scheduled_sales' );
|
|||
function wc_get_attachment_image_attributes( $attr ) {
|
||||
if ( isset( $attr['src'] ) && strstr( $attr['src'], 'woocommerce_uploads/' ) ) {
|
||||
$attr['src'] = wc_placeholder_img_src();
|
||||
|
||||
if ( isset( $attr['srcset'] ) ) {
|
||||
$attr['srcset'] = '';
|
||||
}
|
||||
}
|
||||
return $attr;
|
||||
}
|
||||
|
|
|
@ -1013,7 +1013,7 @@ class WC_Tests_Product_Functions extends WC_Unit_Test_Case {
|
|||
'src' => 'https://wc.local/wp-content/woocommerce_uploads/my-image.jpg',
|
||||
'class' => 'attachment-woocommerce_thumbnail size-woocommerce_thumbnail',
|
||||
'alt' => '',
|
||||
'srcset' => '',
|
||||
'srcset' => 'https://wc.local/wp-content/woocommerce_uploads/my-image-250x250.jpg 250w, https://wc.local/wp-content/woocommerce_uploads/my-image-350x350 350w',
|
||||
'sizes' => '(max-width: 250px) 100vw, 250px',
|
||||
);
|
||||
$expected_attr = array(
|
||||
|
|
Loading…
Reference in New Issue