cor*_*oon 2 php wordpress cart woocommerce
在cart.php中,我们有:
<td class="product-thumbnail" style='background:url(<?php ?>)'>
<?php
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
if ( ! $product_permalink ) {
echo $thumbnail;
} else {
printf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $thumbnail );
}
?>
</td>
Run Code Online (Sandbox Code Playgroud)
有没有办法从中获取 url,以便我可以在 td 元素上使用背景图像而不是内部的图像标签?
能够使用它来工作
<?php echo get_the_post_thumbnail_url($product_id);?>
Run Code Online (Sandbox Code Playgroud)
如果出于某种原因,这不是解决此问题的最佳方法,请分享。
谢谢。