{"id":12315874,"date":"2020-01-11T22:41:32","date_gmt":"2020-01-11T22:41:32","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/clickable-thumbnails-2\/"},"modified":"2020-01-11T22:41:32","modified_gmt":"2020-01-11T22:41:32","slug":"clickable-thumbnails-2","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/clickable-thumbnails-2\/","title":{"rendered":"Clickable Thumbnails"},"content":{"rendered":"<p>Hello @prodesignswpsupport<\/p>\n<p>I have tried everything with child theme and hooks to make thumbnails clickable<br \/>\n(content-product.php added hooks there). Unfortunately, nothing worked for me.<\/p>\n<p>Could you please explain where to add and what hook to add?<\/p>\n<p>Also for better mobile user experience, I have added next extra css:<\/p>\n<p>For hiding add to cart button, since customer wants to visit the product page and only then add to cart &#8230;<br \/>\n.add-to-cart-wrap {<br \/>\ndisplay: none;<br \/>\n}<\/p>\n<p>For hiding hover colour, since the product is not clickable and it confuses customers&#8230;<br \/>\nli.product .product-thumb-wrap::before{<br \/>\nbackground: transparent;<br \/>\n}<\/p>\n<p>Maybe you can just edit the part with working hook?<\/p>\n<p>Thanks alot!<br \/>\nAlex<\/p>\n<p>Here is the original code<\/p>\n<p>&lt;?php<br \/>\n\/**<br \/>\n * The template for displaying product content within loops<br \/>\n *<br \/>\n * This template can be overridden by copying it to yourtheme\/woocommerce\/content-product.php.<br \/>\n *<br \/>\n * HOWEVER, on occasion WooCommerce will need to update template files and you<br \/>\n * (the theme developer) will need to copy the new files to your theme to<br \/>\n * maintain compatibility. We try to do this as little as possible, but it does<br \/>\n * happen. When this occurs the version of the template file will be bumped and<br \/>\n * the readme will list any important changes.<br \/>\n *<br \/>\n * @see     https:\/\/docs.woocommerce.com\/document\/template-structure\/<br \/>\n * @author  WooThemes<br \/>\n * @package WooCommerce\/Templates<br \/>\n *\/<\/p>\n<p>if ( ! defined( &#8216;ABSPATH&#8217; ) ) {<br \/>\n\texit; \/\/ Exit if accessed directly<br \/>\n}<\/p>\n<p>global $product;<\/p>\n<p>\/\/ Ensure visibility<br \/>\nif ( empty( $product ) || ! $product-&gt;is_visible() ) {<br \/>\n\treturn;<br \/>\n}<br \/>\n?&gt;<\/p>\n<p>&lt;li &lt;?php post_class(); ?&gt;&gt;<br \/>\n\t&lt;?php<br \/>\n\tif ( class_exists( &#8216;YITH_WCWL&#8217; ) ){<\/p>\n<p>\t\t$product_wrap = &#8216;product-thumb-wrap yith-enabled&#8217;;<\/p>\n<p>\t}else{<\/p>\n<p>\t\t$product_wrap = &#8216;product-thumb-wrap&#8217;;<\/p>\n<p>\t}<br \/>\n\t?&gt;<\/p>\n<p>\t&lt;div class=&#8221;&lt;?php echo $product_wrap; ?&gt;&#8221;&gt;<br \/>\n\t\t&lt;?php<\/p>\n<p>\t\t\/**<br \/>\n\t\t * woocommerce_before_shop_loop_item_title hook.<br \/>\n\t\t *<br \/>\n\t\t * @hooked woocommerce_show_product_loop_sale_flash &#8211; 10<br \/>\n\t\t * @hooked woocommerce_template_loop_product_thumbnail &#8211; 10<br \/>\n\t\t *\/<br \/>\n\t\tdo_action( &#8216;woocommerce_before_shop_loop_item_title&#8217; ); ?&gt;<\/p>\n<p>\t\t&lt;div class=&#8221;add-to-cart-wrap&#8221;&gt;<br \/>\n\t\t\t&lt;?php<br \/>\n\t\t\t\/**<br \/>\n\t\t\t * woocommerce_after_shop_loop_item hook.<br \/>\n\t\t\t *<br \/>\n\t\t\t * @hooked woocommerce_template_loop_product_link_closed &#8211; 5<br \/>\n\t\t\t * @hooked woocommerce_template_loop_add_to_cart &#8211; 10<br \/>\n\t\t\t *\/<br \/>\n\t\t\tdo_action( &#8216;woocommerce_after_shop_loop_item&#8217; ); ?&gt;<br \/>\n\t\t&lt;\/div&gt;<\/p>\n<p>\t\t&lt;?php <\/p>\n<p>\t\t$show_detail_icon = ecommerce_gem_get_option( &#8216;show_detail_icon&#8217; );<\/p>\n<p>\t\tif( ( true === $show_detail_icon ) || ( class_exists( &#8216;YITH_WCWL&#8217; ) ) ){ ?&gt;<br \/>\n\t\t\t&lt;div class=&#8221;view-detail-wishlist-wrap&#8221;&gt;<br \/>\n\t\t\t\t&lt;div class=&#8221;view-detail-wishlist-inner&#8221;&gt;<br \/>\n\t\t\t\t\t&lt;?php <\/p>\n<p>\t\t\t\t\t$wishlist_page_id = yith_wcwl_object_id( get_option( &#8216;yith_wcwl_wishlist_page_id&#8217; ) ); <\/p>\n<p>\t\t\t\t\tif ( class_exists( &#8216;YITH_WCWL&#8217; ) &amp;&amp; ( absint( $wishlist_page_id ) &gt; 0 ) ){ ?&gt;<br \/>\n\t\t\t\t\t\t&lt;div class=&#8221;add-to-wishlist-wrap&#8221;&gt;<br \/>\n\t\t\t\t\t\t\t&lt;?php echo do_shortcode( &#8216;[yith_wcwl_add_to_wishlist]&#8217;); ?&gt;<br \/>\n\t\t\t\t\t\t&lt;\/div&gt;<br \/>\n\t\t\t\t\t\t&lt;?php<br \/>\n\t\t\t\t\t} <\/p>\n<p>\t\t\t\t\tif( true === $show_detail_icon ){ ?&gt;<\/p>\n<p>\t\t\t\t\t\t&lt;div class=&#8221;view-detail-wrap&#8221;&gt;<br \/>\n\t\t\t\t\t\t\t&lt;?php <\/p>\n<p>\t\t\t\t\t\t\t$link = apply_filters( &#8216;woocommerce_loop_product_link&#8217;, get_the_permalink(), $product );<\/p>\n<p>\t\t\t\t\t\t\t?&gt;<br \/>\n\t\t\t\t\t\t\t<a>&#8221; class=&#8221;view-product&#8221;&gt;&lt;i class=&#8221;fa fa-eye&#8221; aria-hidden=&#8221;true&#8221;&gt;&lt;\/i&gt;<\/a><br \/>\n\t\t\t\t\t\t&lt;\/div&gt;<br \/>\n\t\t\t\t\t\t&lt;?php<br \/>\n\t\t\t\t\t} ?&gt;<br \/>\n\t\t\t\t&lt;\/div&gt;<br \/>\n\t\t\t&lt;\/div&gt;<\/p>\n<p>\t\t\t&lt;?php <\/p>\n<p>\t\t} ?&gt;<br \/>\n\t&lt;\/div&gt;<br \/>\n\t&lt;div class=&#8221;product-info-wrap&#8221;&gt;<br \/>\n\t\t&lt;?php<\/p>\n<p>\t\t\/**<br \/>\n\t\t * woocommerce_before_shop_loop_item hook.<br \/>\n\t\t *<br \/>\n\t\t * @hooked woocommerce_template_loop_product_link_open &#8211; 10<br \/>\n\t\t *\/<br \/>\n\t\tdo_action( &#8216;woocommerce_before_shop_loop_item&#8217; );<\/p>\n<p>\t\t\/**<br \/>\n\t\t * woocommerce_shop_loop_item_title hook.<br \/>\n\t\t *<br \/>\n\t\t * @hooked woocommerce_template_loop_product_title &#8211; 10<br \/>\n\t\t *\/<br \/>\n\t\tdo_action( &#8216;woocommerce_shop_loop_item_title&#8217; );<\/p>\n<p>\t\t\/**<br \/>\n\t\t * woocommerce_after_shop_loop_item_title hook.<br \/>\n\t\t *<br \/>\n\t\t * @hooked woocommerce_template_loop_rating &#8211; 5<br \/>\n\t\t * @hooked woocommerce_template_loop_price &#8211; 10<br \/>\n\t\t *\/<br \/>\n\t\tdo_action( &#8216;woocommerce_after_shop_loop_item_title&#8217; );<br \/>\n\t\t?&gt;<br \/>\n\t&lt;\/div&gt;\n<\/li>\n","protected":false},"template":"","class_list":["post-12315874","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12315874","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12315874\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=12315874"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}