Skip Navigation

Waiting for author

Overview of the issue

When using The Plus Addons for Elementor Pro, the content inside the Tabs widget is not being translated.

Workaround

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

  • Open your theme’s functions.php file.
    add_filter('elementor/frontend/before_render', 'wpml_compsupp7837_filter_loop_grid_widget');
    
    function wpml_compsupp7837_filter_loop_grid_widget($element) {
        if ('tp-tabs-tours' !== $element->get_name()) {
            return $element;
        }
    
        $settings = $element->get_settings();
    
        if (!isset($settings['tabs']) || !is_array($settings['tabs'])) {
            return $element;
        }
    
        $tabs = $settings['tabs'];
    
        foreach ($tabs as $key => $value) {
            if (empty($value['content_template']) || !is_numeric($value['content_template'])) {
                continue;
            }
            // Use apply_filters to adjust template_id for WPML
            $id = apply_filters('wpml_object_id', $value['content_template'], get_post_type($value['content_template']), true);
            if (!is_numeric($id)) {
                continue;
            }
            $tabs[$key]['content_template'] = $id;
        }
    
    
        $settings['tabs'] = $tabs;
        $element->set_settings('tabs', $settings['tabs']);
    }
            

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>