- 状态
- 已由作者解决
- 相关插件/主题
- ThemeREX Addons
- 主题标签
- Compatibility
问题概述
将 ThemeREX Addons 与 WPML 一起使用时,您可能会在包含 Testimonials 小工具的已翻译页面上遇到 PHP 致命错误。错误信息如下:
Fatal error: Uncaught TypeError: Cannot access offset of type string on string in .../wp-content/plugins/trx_addons/cpt/testimonials/tpl.default-item.php:33
临时解决方法
为防止出现此错误,请将相关的自定义字段和简码属性设置为可翻译。
- 在您的 WordPress 仪表盘中,前往 WPML > 设置 > 自定义 XML 配置。
- 添加以下 XML 配置并保存:
<wpml-config> <custom-fields> <custom-field action="translate">trx_addons_options</custom-field> </custom-fields> <shortcodes> <shortcode> <tag>trx_sc_testimonials</tag> <attributes> <attribute type="taxonomy-ids" sub-type="cpt_testimonials_group">cat</attribute> <attribute type="post-ids" sub-type="cpt_testimonials">ids</attribute> <attribute>subtitle</attribute> </attributes> </shortcode> </shortcodes> </wpml-config>