【发布时间】:2014-11-25 15:57:22
【问题描述】:
我有一个安装了 WooCommerce 插件的基于 WordPress 的网站。
在单个产品页面上,有产品描述、产品图片,以及该项目所在的类别和标签。
如何更改“类别”和“标签”标题/文本以显示为其他内容?
例如,将“类别”更改为“州”,将“标签”更改为“郊区”?
【问题讨论】:
标签: php wordpress woocommerce
我有一个安装了 WooCommerce 插件的基于 WordPress 的网站。
在单个产品页面上,有产品描述、产品图片,以及该项目所在的类别和标签。
如何更改“类别”和“标签”标题/文本以显示为其他内容?
例如,将“类别”更改为“州”,将“标签”更改为“郊区”?
【问题讨论】:
标签: php wordpress woocommerce
这可以在/single-product/meta.php 模板中更改。您可以查看源代码on GitHub。
有关覆盖默认模板的更多信息,您需要阅读the WooCommerce docs on overriding template files。
【讨论】:
为了快速重命名 woo 中的任何内容:
add_filter('gettext', 'translate_text');
add_filter('ngettext', 'translate_text');
function translate_text($translated) {
$translated = str_ireplace('Choose and option', 'Select', $translated);
return $translated;
}
【讨论】: