Woocommerce 产品标题

Woocommerce products title

我想问一下如何自定义woo commerce产品images.I想添加alt title特色产品。我一直在调整 functions.php 。我看到 woocommerce_get_product_thumbnail() 如何自定义它以输出像这样的图像标题:

<img src="www.source.com" title="image title">

你可以这样做

remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);

if (!function_exists('change_product_image')) {
    function change_product_image( $html ){
        global $post;

        $html = get_the_post_thumbnail( $post->ID, 'full' );

        echo $html;
    }
}

add_action( 'woocommerce_before_shop_loop_item_title', 'change_product_image', 10 );

首先从 woocommerce 中删除显示图像的默认操作,然后使用您的函数输出您的操作。

你可以玩玩这个。改变大小,找出每个图像的属性等