Created
January 23, 2018 21:35
-
-
Save shreyans94/1855adf0b7983e24cf25be5cb4e76886 to your computer and use it in GitHub Desktop.
Apply woocommerce product title to all product images alt tags (WooThumbs Compatible)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function iconic_modify_woothumbs_all_images_data( $image_data, $product_id ) { | |
$title = get_the_title( $product_id ); | |
foreach( $image_data as $index => $image ) { | |
$image_data[ $index ]['alt'] = $title; | |
} | |
return $image_data; | |
} | |
add_filter( 'iconic_woothumbs_all_images_data', 'iconic_modify_woothumbs_all_images_data', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment