Rename Description tab in Woocommerce single product page(Woocommerce 单品页面中的重命名描述选项卡)
问题描述
我将此代码粘贴到 function.php 中,但它没有按预期重命名产品页面选项卡 (http://www.noushasasart.com/product/harsh-bark/)
I pasted this code in function.php, but it didn't rename the product page tab as it supposed to (http://www.noushasasart.com/product/harsh-bark/)
function woo_remove_product_tabs($tabs) {
unset($tabs['reviews']); // Remove the reviews tab
$tabs['description']['title'] = __('Additional Information'); // Rename the
description tab
return $tabs;
}
我该如何解决这个问题?
how can I solve this?
推荐答案
你忘记了过滤钩子:
add_filter( 'woocommerce_product_tabs', 'woo_customize_tabs', 100, 1 );
function woo_customize_tabs( $tabs ) {
unset($tabs['reviews']); // Remove the reviews tab
$tabs['description']['title'] = __( 'More Information' ); // Rename the description tab
return $tabs;
}
代码进入您的活动子主题(或主题)的 function.php 文件或任何插件文件中.
所有代码都在 Woocommerce 3+ 上进行了测试并且可以运行.
All code is tested on Woocommerce 3+ and works.
更新(与您的评论相关) |重命名产品描述标题(在标签内):
Update (related to your comment) | Rename product description heading (inside the tab):
要重命名描述标题,请以这种方式使用 woocommerce_product_description_heading
过滤钩子:
To rename description heading use woocommerce_product_description_heading
filter hook this way:
add_filter( 'woocommerce_product_description_heading', 'rename_product_description_heading', 10, 1 );
function rename_product_description_heading( $heading ) {
return __( 'Additional Information', 'woocommerce' );
}
代码进入您的活动子主题(或主题)的 function.php 文件或任何插件文件中.
所有代码都在 Woocommerce 3+ 上进行了测试并且可以运行.
All code is tested on Woocommerce 3+ and works.
官方相关文档:编辑产品数据标签
这篇关于Woocommerce 单品页面中的重命名描述选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Woocommerce 单品页面中的重命名描述选项卡


基础教程推荐
- 超薄框架REST服务两次获得输出 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- 在多维数组中查找最大值 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01