- 状态
- 已解决
- 解决于
- WooCommerce Multilingual 4.11.0
问题概述
在某些情况下,当您的主题使用 taxonomy-product_cat.php 模板,并且您使用 Elementor PRO 创建了产品归档并将其翻译时,翻译后的产品归档页面将显示默认模板,而不是您使用 Elementor PRO 创建的模板。
临时解决方法
我们正在 WooCommerce Multilingual 中修复此问题。在此期间,您可以使用以下临时解决方法来解决该问题:
- 在进行此更改之前,请确保您已备份网站文件和数据库。
- 将以下代码添加到主题的 functions.php 文件中:
add_filter('template_include', function ($template){
if (function_exists('wc_locate_template') && strpos($template, 'elementor') !== false && !file_exists(wc_locate_template(basename($template)))) {
global $woocommerce_wpml;
remove_filter( 'template_include', [ $woocommerce_wpml->store, 'template_loader' ], 100 );
}
return $template;
}, 12);