问题概述
将 Addon Elements for Elementor 与 WPML 配合使用时,您可能会遇到以下问题:在 Content Switcher、Modal Popup、Dropbar 或 Data Table 小工具中显示的已保存模板,在翻译后的页面上仍显示为默认语言。
临时解决方法
将以下代码添加到您的子主题的 functions.php 文件中:
PHP
add_filter( 'elementor/documents/get/post_id', function ( $id ) {
if ( 'elementor_library' === get_post_type( $id ) ) {
$id = apply_filters( 'wpml_object_id', $id, 'elementor_library', true );
}
return $id;
} );这样,Content Switcher、Modal Popup、Dropbar 和 Data Table 小工具将在已翻译的页面上显示已翻译的模板。