Cant find the Thumbnail Loop and overwritte the filter
-
Hi im working on a plugin now i have a problem i can change the Single Thumbnail and add class. But i cant filter the thumbnails in the loop
i want to do de the same thing in the thumbnail loop
remove_filter('woocommerce_single_product_image_html', 'woocommerce_single_product_image_html'); add_filter('woocommerce_single_product_image_html', 'overwritte_product_image'); function overwritte_product_image($post) { global $post; $the_thumbnail_id = get_post_thumbnail_id( $post->ID ); $image_link = wp_get_attachment_url( $the_thumbnail_id ); $image = wp_get_attachment_image( $the_thumbnail_id, apply_filters( 'single_product_small_thumbnail_size', 'shop_single' ) ); $image_title = esc_attr( get_the_title( $post->ID) ); //Check if User has Acces and then Put a span with "freeprodukt" if (user_has_access($post->ID) == 2) { echo sprintf( '<li><span class="free-item" style="position:absolute; display:block; background: #ed5a48; color:white; bottom:0; padding:15px;">Freigeschalten!</span><a href="%s" itemprop="image" class="woocommerce-main-image zoom" title="%s" data-rel="prettyPhoto">%s</a></li>', $image_link, $image_title, $image ); } else { echo sprintf( '<li><a href="%s" itemprop="image" class="woocommerce-main-image zoom" title="%s" data-rel="prettyPhoto">%s</a></li>', $image_link, $image_title, $image ); } }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Cant find the Thumbnail Loop and overwritte the filter’ is closed to new replies.