Open
Overview of the issue
When using Elementor Pro’s Loop Grid with alternate templates, non-dynamic content translated within the loop template does not appear in the correct language on the frontend. This issue occurs because the alternate template IDs are not translated.
Workaround
Please, make sure of having a full backup of your site before proceeding.
- Open your theme’s functions.php file.
- Add the following code:
// 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']); }
Hi, I am having an issue but I am not able to start a new topic.
My translation is not showing in the front end but I can see it in the back-end
Hello Luis,
We are unable to debug here as we don’t have the required tools to check your website. Please, check if you have a valid WPML license and if you still can’t start a new topic, contact us to hello@wpml.org where we will check if there is any issue with your login details.
Regards