-
-
Save netwizards/19a15aa17126179d2914097605404bd8 to your computer and use it in GitHub Desktop.
Adds link and title the image, it applies to all archives of products #sublime #woocommerce
This file contains hidden or 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
| <?php | |
| /* This snippet removes the action that inserts thumbnails to products in the loop | |
| * and adds link and title the image, it applies to all archives of products. | |
| * | |
| * @original plugin: WooCommerce | |
| * @author of snippet: Luis Ruiz | |
| **/ | |
| remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10); | |
| add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10); | |
| if ( ! function_exists( 'woocommerce_template_loop_product_thumbnail' ) ) { | |
| function woocommerce_template_loop_product_thumbnail() { | |
| global $product; | |
| $link=get_permalink( $poduct->ID); | |
| $title=$poduct->post_title; | |
| echo '<a href="'.$link.'" title="'.$title.'">'.woocommerce_get_product_thumbnail().'</a>'; | |
| } | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment