Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 -
- - - - - - -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 0 replies, has 0 voices.

Last updated by Waqas Bin Hasan 3 days, 22 hours ago.

Assisted by: Waqas Bin Hasan.

Author Posts
January 17, 2025 at 9:45 am

felixK-9

Background of the issue:
I am trying to use Elementor Loop 'Alternate Template' to display translations on my website. The issue can be seen on this page: hidden link

Symptoms:
Elementor Loop 'Alternate Template' is not using the translation and is showing German instead of the expected English/Czech translation.

Questions:
Why is the Elementor Loop 'Alternate Template' not displaying the correct translation?
How can I ensure the Elementor Loop 'Alternate Template' shows the English/Czech translation instead of German?

January 17, 2025 at 10:39 am
January 17, 2025 at 10:51 am #16605485

felixK-9

The dev site is now updated and the issue is reproducible at

hidden link

"Mit dem VMS zu den Veranstaltungen der Kulturhauptstadt" is not translated.

January 17, 2025 at 2:20 pm #16606529

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the updates, I can see the problem. I've also checked in very much detail as well as some workaround taken from an existing report. But none of this seems to work so far.

However, I need more time on this to check a few other solutions. I'll get back to you on Monday.

Thanks again for your patience and cooperation.

January 20, 2025 at 4:38 am #16611640

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation. I've escalated the matter to our 2nd tier team and 'll get back to you as soon as I hear back.

January 21, 2025 at 7:04 am #16616454

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation.

Our team proposed the following workaround:

- Add the following code in your current theme's functions.php file:

// WPML Workaround for compsupp-6865
add_filter('elementor/frontend/before_render', 'wpml_compsupp6865_filter_loop_grid_widget');

function wpml_compsupp6865_filter_loop_grid_widget($element) {
    if ('loop-grid' !== $element->get_name()) {
        return $element;
    }

    $settings = $element->get_settings();

    if (!isset($settings['alternate_templates']) || !is_array($settings['alternate_templates'])) {
        return $element;
    }

    $alternate_settings = $settings['alternate_templates'];

    foreach ($alternate_settings as $key => $value) {
        if (empty($value['template_id']) || !is_numeric($value['template_id'])) {
            continue;
        }

        // Use apply_filters to adjust template_id for WPML
        $id = apply_filters('wpml_object_id', $value['template_id'], get_post_type($value['template_id']), true);
        if (!is_numeric($id)) {
            continue;
        }

        // Update the template_id in alternate_settings
        $alternate_settings[$key]['template_id'] = $id;
    }

    // Update the settings with the modified alternate_templates
    $settings['alternate_templates'] = $alternate_settings;
    $element->set_settings('alternate_templates', $settings['alternate_templates']);
}

- Save the file.
- Clear all caches and recheck.

I've applied this code in your staging site's Hello Elementor Child theme's functions.php file and it solved the problem. Please check at hidden link and hidden link.

When you apply this on your live site, please remember to take full backup of your site and database beforehand.

Please let me know if this works for you.

January 21, 2025 at 10:17 am #16617604

felixK-9

Thank you, this seems to have worked on the live site as well. Can you keep me posted when this is fixed in the plugin itself?

January 21, 2025 at 12:05 pm #16618218

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the confirmation.

Sure I'll update you as soon as there more progress on it.

January 23, 2025 at 5:09 am #16625536

Waqas Bin Hasan
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

I just wanted to update you that our team has published this errata https://wpml.org/errata/elementor-pro-loop-grid-alternate-templates-non-dynamic-content-is-not-translated/.

You can subscribe to the comments of the errata, so when there's a progress you can get an update.