woocommerce_gallery_image_html_attachment_image_params
Filters the attributes for the image markup.
Usage
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(array)
- Attributes for the image markup.
- $attachment_id
- -
- $image_size
- -
- $main_image
- -
Changelog
Since 3.3.2 | Introduced. |
Where the hook is called
woocommerce_gallery_image_html_attachment_image_params
woocommerce/includes/wc-template-functions.php 1722-1737
$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 );