我遇到以下问题:
我正在为客户端使用WordPress主题。他希望我编辑购物车页面(woocommerce),主题使用自己的woocommerce功能。我的客户想要禁用购物车页面内的缩略图链接。
代码是:
printf( '<a href="%s">%s</a>', $_product->get_permalink( $cart_item ), $thumbnail );
出于某种原因,无论我编辑/编码,页面要么变成白色,要么缩略图不再显示,而是显示链接,所以我无法更改%s ... < / p>
完整的PHP代码:
<td class="product-thumbnail">
<?php
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
if ( ! $_product->is_visible() )
echo wp_kses_post( $thumbnail );
else
printf( '<a href="%s">%s</a>', $_product->get_permalink( $cart_item ), $thumbnail );
?>
</td>
这是HTML(检查元素)
<td class="product-thumbnail">
<a href="FAKELINKFAKELINK"><img width="180" height="180" src="FAKELINKFAKELINK/image.jpg/" class="attachment-shop_thumbnail wp-post-image" alt="image-alt"></a> </td>
还有谁有这个问题?或者我该如何解决?
谢谢!
答案 0 :(得分:2)
要从此页面删除链接,
<td class="product-thumbnail">
<?php
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
if ( ! $_product->is_visible() )
echo wp_kses_post( $thumbnail );
else
printf( '<a class="hidden" href="%s"></a>%s', $_product->get_permalink( $cart_item ), $thumbnail );
?>
</td>
将此添加到您的css
.hidden { display: none !important; }