2013-07-25 19 views
3

我試圖在Woocommerce中添加新產品時刪除特色圖片上的鏈接。我在以前的版本中做過,但自更新以來,我似乎無法找到我編輯它的方式/位置。試圖查看一些文件無濟於事。任何幫助?Woocommerce刪除特色圖片上的鏈接

回答

10

我最初使用CSS:pointer-events:none;

鏈接類(我想我用.zoom IMG),但是我需要使用圖像的一個jQuery變焦所以搜索了幾個小時之後,我發現這個解決方案,只需添加這對你的functions.php,它會排序你。

/** 
    * Remove link wrapping main product image in single product view. 
    * @param $html 
    * @param $post_id 
    * @return string 
*/ 

function custom_unlink_single_product_image($html, $post_id) { 
    return get_the_post_thumbnail($post_id, apply_filters('single_product_large_thumbnail_size', 'shop_single')); 
} 

add_filter('woocommerce_single_product_image_html', 'custom_unlink_single_product_image', 10, 2);