ナビゲーションをスキップ

Open

Topic Tags: Compatibility

Overview of the issue

When using the Content Toggle widget from the Ultimate Addons for Elementor plugin, translated Elementor templates are not displayed correctly when using the Advanced Translation Editor (ATE). Instead of showing the translated template, the widget displays the original language content on the translated page.

Workaround

Please, make sure of having a full site backup of your site before proceeding.

  • Open your theme’s functions.php file.
  • Add the following snippet:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    // WPML: Workaround for compsupp-7677
    add_filter('elementor/frontend/before_render', 'wpml_compsupp7677_translate_content_toggle');
     
    function wpml_compsupp7677_translate_content_toggle($element) {
        if (!class_exists('SitePress') || 'uael-content-toggle' !== $element->get_name()) {
            return;
        }
     
        $settings = $element->get_settings();
        $keys_to_convert = [
            'section_content_',
            'saved_pages_',
            'section_saved_rows_'
        ];
     
        $modified = false;
        foreach ($keys_to_convert as $key) {
            for ($i = 1; $i <= 2; $i++) {
                $setting_key = $key . $i;
                 
                if (isset($settings[$setting_key]) && is_numeric($settings[$setting_key])) {
                    $post_type = get_post_type($settings[$setting_key]);
                     
                    if ($post_type) {
                        $settings[$setting_key] = apply_filters(
                            'wpml_object_id',
                            $settings[$setting_key],
                            $post_type,
                            true
                        );
                        $modified = true;
                    }
                }
            }
        }
     
        if ($modified) {
            $element->set_settings($settings);
        }
    }

返信を投稿

トピックに沿って他の人を尊重してください。この投稿に関連しない問題について助けが必要な場合は、サポートフォーラムを使用してチャットを開始するかチケットを送信してください。

以下のタグを使用できます:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>