如何更改循环中的woocommerce产品标题

如何更改循环中的woocommerce产品标题,例如更改shop , category页面等中的产品拼贴?如何更改循环中的woocommerce产品标题

我正在寻找可以帮助解决此问题的挂钩。当转到woocommerce/content-product.php它显示

<?php 

do_action('woocommerce_before_shop_loop_item_title');

echo '<div class="title-wrapper">';

do_action('woocommerce_shop_loop_item_title');

echo '</div>';

请帮助

我想改变shop page , category page等产品的瓷砖。但在single product page, or cart, checkout页面我不想更改标题。还有关于shotcodes [products ids="12,34,56,"];?我如何更改标题?

回答:

remove_action('woocommerce_shop_loop_item_title','woocommerce_template_loop_product_title',10); 

add_action('woocommerce_shop_loop_item_title','fun',10);

function fun()

{

echo 'Your Title for the product';

}

上面的代码将删除默认标题和调用另一个函数,它会显示你自己的标题到位。现在您已经为每个产品标题编写了自己的逻辑。我对它进行了测试,它对我很有用。

希望它也适用于你。

以上是 如何更改循环中的woocommerce产品标题 的全部内容, 来源链接: utcz.com/qa/260988.html

回到顶部