WPML
Status
Resolved
Reported for
WPML Multilingual CMS 4.5.14
Resolved in
WPML 4.6.4
Related plugin/theme
Elementor
Topic tags
Compatibility

Overview of the issue

If you are using the Elementor loop template feature, buttons aren’t translated on the front-end even if they are available for translation in the Advanced Translation Editor.

Workaround

Please be sure of making a full backup of your site before proceeding.


  1. Open the /wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/class-wpml-elementor-translate-ids.php file.

  2. Look for line 108.

  3. Replace the WPML_Elementor_Translate_IDs::translate_global_widget_ids() method:
    public function translate_global_widget_ids( $data_array, $post_id ) {
    		foreach ( $data_array as &$data ) {
    			if ( isset( $data['elType'] ) && 'widget' === $data['elType'] ) {
    				if ( 'global' === $data['widgetType'] ) {
    					$data['templateID'] = $this->translate_id( $data['templateID'] );
    				} elseif ( 'template' === $data['widgetType'] ) {
    					$data['settings']['template_id'] = $this->translate_id( $data['settings']['template_id'] );
    				}
    			}
    			$data['elements'] = $this->translate_global_widget_ids( $data['elements'], $post_id );
    		}
    
    		return $data_array;
    	}

    With:

    public function translate_global_widget_ids( $data_array, $post_id ) {
            foreach ( $data_array as &$data ) {
                if ( isset( $data['elType'] ) && 'widget' === $data['elType'] ) {
                    if ( 'global' === $data['widgetType'] ) {
                        $data['templateID'] = $this->translate_id( $data['templateID'] );
                    } elseif ( 'template' === $data['widgetType'] || 'loop-grid' === $data['widgetType'] || 'loop-carousel' === $data['widgetType']) {
                        $data['settings']['template_id'] = $this->translate_id( $data['settings']['template_id'] );
                    } 
                }
                $data['elements'] = $this->translate_global_widget_ids( $data['elements'], $post_id );
            }
      
            return $data_array;
        }


  4. Translate the Elementor loop template in WPMLTranslation Management.

All known issues →