woocommerce_gallery_image_html_attachment_image_params хук-фильтрWC 3.3.2

Filters the attributes for the image markup.

Использование

add_filter( 'woocommerce_gallery_image_html_attachment_image_params', 'wp_kama_woocommerce_gallery_image_html_attachment_params_filter', 10, 4 );

/**
 * Function for `woocommerce_gallery_image_html_attachment_image_params` filter-hook.
 * 
 * @param array $image_attributes Attributes for the image markup.
 * @param       $attachment_id    
 * @param       $image_size       
 * @param       $main_image       
 *
 * @return array
 */
function wp_kama_woocommerce_gallery_image_html_attachment_params_filter( $image_attributes, $attachment_id, $image_size, $main_image ){

	// filter...
	return $image_attributes;
}
$image_attributes(массив)
Attributes for the image markup.
$attachment_id
-
$image_size
-
$main_image
-

Список изменений

С версии 3.3.2 Введена.

Где вызывается хук

wc_get_gallery_image_html()
woocommerce_gallery_image_html_attachment_image_params
woocommerce/includes/wc-template-functions.php 1740-1755
$image_params = apply_filters(
	'woocommerce_gallery_image_html_attachment_image_params',
	array(
		'title'                   => _wp_specialchars( get_post_field( 'post_title', $attachment_id ), ENT_QUOTES, 'UTF-8', true ),
		'data-caption'            => _wp_specialchars( get_post_field( 'post_excerpt', $attachment_id ), ENT_QUOTES, 'UTF-8', true ),
		'data-src'                => esc_url( $full_src[0] ),
		'data-large_image'        => esc_url( $full_src[0] ),
		'data-large_image_width'  => esc_attr( $full_src[1] ),
		'data-large_image_height' => esc_attr( $full_src[2] ),
		'class'                   => esc_attr( $main_image ? 'wp-post-image' : '' ),
		'alt'                     => esc_attr( $alt_text ),
	),
	$attachment_id,
	$image_size,
	$main_image
);

Где используется хук в WooCommerce

Использование не найдено.