Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // function to slice out alt texts from WooCommerce images
- // code goes in functions.php for your child theme
- // echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<a href="%s" itemprop="image" class="woocommerce-main-image zoom" title="%s" data-rel="prettyPhoto' . $gallery . '">%s</a>', $image_link, $image_caption, $image ), $post->ID );
- add_filter ('woocommerce_single_product_image_html', 'my_function');
- function my_function($html) {
- $start = stripos($html, 'alt="');
- if ($start) {
- $end = stripos($html, '"', $start + 5);
- $html = substr($html, 0, $start - 1).substr($html, $end + 1);
- }
- return $html;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement