WPML
状态
已解决
解决于
WPML 4.7.5
相关插件/主题
Avada
主题标签
Compatibility

问题概述

如果您使用的是 Avada 主题,您会发现在 Avada Forms 中设置的通知值无法在高级翻译编辑器中进行翻译。

临时解决方法

在继续操作之前,请确保对您的站点进行完整备份


  • 打开您主题的 functions.php 文件。

  • 添加以下代码:
    /*
    WPML Updated workaround for AVADA
    REF: compsupp-6224
    */
    add_filter( 'wpml_decode_custom_field', 'wpmld_compsupp6224_decode', 10, 2 );
    function wpmld_compsupp6224_decode( $custom_field_val, $custom_field_name ) {
        if ( $custom_field_name === '_fusion' ) {
    		$custom_field_val['notifications'] = json_decode($custom_field_val['notifications']);
    		foreach($custom_field_val['notifications'] as $key => $value) {
    			$custom_field_val['notifications'][$key] = (array)$value;
    		}
    		
    	}
    	return $custom_field_val;
    }
    
    add_filter( 'wpml_encode_custom_field', 'wpmld_compsupp6224_encode', 10, 2 );
    function wpmld_compsupp6224_encode( $custom_field_val, $custom_field_name ) {
    	if ( $custom_field_name === '_fusion' ) {
    		$custom_field_val['notifications'] = json_encode($custom_field_val['notifications']);
    	}
    	return $custom_field_val;
    }

  • 转到 WPML > 设置 > 自定义 XML 配置页面。

  • 添加以下 XML:
    <wpml-config>
      <custom-fields-texts>
            <key name="_fusion">
                <key name="page_title_custom_text" />
                <key name="page_title_custom_subheader" />
                <key name="video" />
                <key name="link_icon_url" />
                <key name="video_url" />
                <key name="project_url" />
                <key name="project_url_text" />
                <key name="copy_url" />
                <key name="copy_url_text" />
                <key name="youtube_id" />
                <key name="heading" />
                <key name="caption" />
                <key name="button_1" />
                <key name="button_2" />
                <key name="vimeo_id" />
                <key name="notifications">
                    <key name="*">
                        <key name="label"/>
                        <key name="email_subject"/>
                        <key name="email_from"/>
                        <key name="email_from_id"/>
                        <key name="email_reply_to"/>
                        <key name="email_message"/>
                        <key name="email_from"/>
                        <key name="email_from_id"/>
                    </key>
                </key>
            </key>
        </custom-fields-texts>
    </wpml-config>
  • 向您的表单添加一个简短的通知并重新翻译。

所有已知问题 →