woocommerce - Woocommerce 在产品页面上隐藏前缀
问题描述
我使用片段在价格之前添加前缀。它工作得很好,但我希望它只显示在类别产品页面上。
我想在简单的产品页面上隐藏前缀。
你能帮助我吗?
谢谢!
使用的片段:
add_filter( ‘woocommerce_get_price_html’, ‘njengah_text_before_price’ );
function njengah_text_before_price($price){
global $post;
$product_id = $post->ID;
$product_array = array( 25338 );//add in the product IDs to add text after price
if ( in_array( $product_id, $product_array )) {
$text_to_add_before_price = ‘ Cena od ‘; //change text in bracket to your preferred text
return $text_to_add_before_price . $price ;
}else{
return $price;
}
}
解决方案
推荐阅读
- java - com.sun.imageio.plugins.jpeg.JPEGImageReader 不再是 JDK-11 的一部分
- java - 在 android studio 中添加 32bit 和 64bit 的外部库
- sphinx - SphinxSearch 不返回某些已定义的属性
- javascript - NodeJS - JSON数组推送元素但不会增加长度
- google-maps - vue google maps - 仅为“fitBounds”调用设置最大缩放级别
- eclipse - Eclipse 格式化程序没有正确缩进
- reactjs - (PDF.js) 如何将 Hand 工具添加到您的 pdf 页面
- java - 如何解决 Neo4J-admin 导入中的未排序数据错误
- c++ - selectedIndexes() 返回的 QModelIndexList 始终为空
- javascript - 从 LAN 中的其他设备访问我的 ReactJS 项目