问题概述
将 GreenShift 13.2.1 或更高版本与 WPML 一起使用时,您可能会遇到以下问题:在翻译后的页面上,GreenShift 标题、高级文本和按钮区块会在区块编辑器中显示“此区块包含意外或无效内容”。翻译后的页面在前端显示正确的文本。如果您在区块编辑器中修复这些区块,它们会恢复为默认语言的文本。
临时解决方法
前往 WPML设置自定义 XML 配置,添加以下代码并保存。然后更新使用这些区块的每个页面的翻译。
XML
<wpml-config>
<gutenberg-blocks>
<gutenberg-block type="greenshift-blocks/heading" translate="1" label="Advanced heading">
<xpath>//*[contains(@class, 'gspb_heading')]</xpath>
<key name="headingContent" />
<key name="title" />
<key name="text" />
<key name="textbefore" />
<key name="textafter" />
<key name="customAnchor" />
<key name="subTitle" />
<key name="animatedText"><key name="*" /></key>
<key name="dynamictext"><key name="dynamicField" /></key>
</gutenberg-block>
<gutenberg-block type="greenshift-blocks/text" translate="1" label="Advanced text">
<xpath>//*[contains(@class, 'gspb_text')]</xpath>
<key name="textContent" />
<key name="text" />
<key name="customAnchor" />
<key name="dynamictext"><key name="dynamicField" /></key>
</gutenberg-block>
<gutenberg-block type="greenshift-blocks/button" translate="1" label="Advanced Button">
<xpath>//*[contains(@class, 'gspb_button_wrapper')]</xpath>
<key name="buttonContent" />
<key name="label" />
<key name="buttonLink" />
<key name="customAnchor" />
<key name="closeLabel" />
<key name="openLabel" />
</gutenberg-block>
<gutenberg-block type="greenshift-blocks/buttonbox" translate="1" label="Advanced Button">
<xpath>//*[contains(@class, 'gspb_button_wrapper')]</xpath>
<key name="buttonContent" />
<key name="label" />
<key name="buttonLink" />
<key name="customAnchor" />
<key name="closeLabel" />
<key name="openLabel" />
</gutenberg-block>
</gutenberg-blocks>
</wpml-config>