问题概述
将 YITH WooCommerce Badge Management Premium 与 WPML 一起使用时,您可能会遇到以下问题:翻译后的徽章会丢失其设置,例如类型、颜色和位置。WPML 不会复制这些设置,因此翻译后的徽章已禁用。使用此徽章的已翻译产品不会显示徽章。
临时解决方法
让 WPML 将徽章设置复制到翻译后的徽章中:
- 前往WPML设置并打开自定义 XML 配置选项卡。
- 粘贴以下代码并单击保存。
- 更新原始徽章和产品,以便 WPML 更新其翻译。
XML
<wpml-config> <custom-fields> <custom-field action="copy">_yith_wcbm_badge_from_date</custom-field> <custom-field action="copy" type="post-ids">_yith_wcbm_badge_ids</custom-field> <custom-field action="copy">_yith_wcbm_badge_schedule</custom-field> <custom-field action="copy">_yith_wcbm_badge_to_date</custom-field> <custom-field action="translate">_text</custom-field> <custom-field action="copy">_enabled</custom-field> <custom-field action="copy">_type</custom-field> <custom-field action="copy">_image</custom-field> <custom-field action="copy">_background_color</custom-field> <custom-field action="copy">_size</custom-field> <custom-field action="copy">_padding</custom-field> <custom-field action="copy">_border_radius</custom-field> <custom-field action="copy">_position</custom-field> <custom-field action="copy">_alignment</custom-field> </custom-fields> </wpml-config>