woocommerce_placeholder_img
Filters the placeholder image HTML.
Использование
add_filter( 'woocommerce_placeholder_img', 'wp_kama_woocommerce_placeholder_img_filter', 10, 4 );
/**
* Function for `woocommerce_placeholder_img` filter-hook.
*
* @param string $image_html The placeholder image HTML.
* @param string $size Image size.
* @param array $dimensions Image width and height.
* @param array $attr Attributes for the image markup.
*
* @return string
*/
function wp_kama_woocommerce_placeholder_img_filter( $image_html, $size, $dimensions, $attr ){
// filter...
return $image_html;
}
- $image_html(строка)
- The placeholder image HTML.
- $size(строка)
- Image size.
- $dimensions(массив)
- Image width and height.
- $attr(массив)
- Attributes for the image markup.
Список изменений
| С версии 2.0.0 | Введена. |
| С версии 11.1.0 | Added the $attr parameter. |
Где вызывается хук
woocommerce_placeholder_img
woocommerce/includes/wc-product-functions.php 495
return apply_filters( 'woocommerce_placeholder_img', $image_html, $size, $dimensions, $attr );