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
- 8:00 – 14:00 8:00 – 14:00 8:00 – 14:00 8:00 – 14:00 8:00 – 14:00 -
- 15:00 – 17:00 15:00 – 17:00 15:00 – 17:00 15:00 – 17:00 15:00 – 17:00 -

Supporter timezone: Europe/Madrid (GMT+01:00)

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by Nigel 1 year ago.

Assisted by: Nigel.

Author Posts
October 9, 2023 at 3:35 am #14535689

jiyoonb

Hi,

Tell us what you are trying to do?

I save images differently by media translation are not properly visible on the translated English site and still appear as Korean images.

hidden link

Media translation Sreenshot.jpg
October 9, 2023 at 11:27 am #14538859

Nigel
Supporter

Timezone: Europe/Madrid (GMT+01:00)

Hi there

To confirm, you are using different images on the different language versions of the posts, not just translating the texts associated with the images (like alt text), yes?

Can I check how you are inserting the images on the page?

I suspect that if you were to just insert the image on a test page you make with the block editor and translate the page the correct versions of the image would appear, and that the issue arises because of how the image is inserted.

Could you please clarify that?

October 9, 2023 at 3:15 pm #14541097

jiyoonb

Yes, I'm using different images on the different language versions of the posts.
I inserted the image with Elementor editor.

October 9, 2023 at 3:44 pm #14541367

Nigel
Supporter

Timezone: Europe/Madrid (GMT+01:00)

It looks like the image is inserted in something other than a standard Elementor module (screenshot).

Would it be possible for me to get access to your site so I can check exactly how the image is added. I need to be sure of that to be able to try and reproduce the problem.

Let me mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site.

Screenshot 2023-10-09 at 16.40.27.png
October 10, 2023 at 10:19 am #14548617

Nigel
Supporter

Timezone: Europe/Madrid (GMT+01:00)

Thanks for that.

I was able to confirm that the images are added via the Timeline widget of the Qi Addons for Elementor plugin.

I tested the issue on my own local test site and was able to reproduce the issue.

The problem arises because the WPML configuration file included with the plugin by its authors does not include handling for the images.

We have a tool available to generate custom XML to configure custom widgets, and I generated an updated wpml-config.xml for the Timeline widget, but that still did not work.

I've asked my colleagues in the compatibility team to take a closer look. Hopefully they can suggest an update to the configuration for the widget so that it works (and then share that with the plugin authors, too).

I'll get back to you when I have an update from them.

October 11, 2023 at 6:50 am #14555391

Nigel
Supporter

Timezone: Europe/Madrid (GMT+01:00)

OK, I have a workaround that you can use so that replacing the images works with the Timeline widget from Qi Addons for Elementor.

First, go to WPML > Settings and the Custom XML Configuration tab and add the following:

<wpml-config>
  <elementor-widgets>
    <widget name="qi_addons_for_elementor_timeline">
      <fields>
        <field>children</field>
      </fields>
      <fields-in-item items_of="children">
        <field key_of="image">id</field>
        <field key_of="image">url</field>
        <field key_of="image">alt</field>
        <field key_of="image">source</field>
        <field key_of="image">size</field>
        <field>title</field>
        <field>date</field>
        <field>text</field>
        <field>_id</field>
      </fields-in-item>
    </widget>
  </elementor-widgets>
</wpml-config>

You will also need to add some PHP to your site. The best way to do that would be with a plugin like Code Snippets, or you could add it to the functions.php file of a child theme.

This is the code you'll need (it only needs to run on the front end, which you can specify with the Code Snippets plugin):

// WPML Workaround for compsupp-7006
add_filter( 'elementor/frontend/before_render', 'wpml_compsupp7006_qi_addons_for_elementor_timeline_widget');

function wpml_compsupp7006_qi_addons_for_elementor_timeline_widget($element) {
	if ( 'qi_addons_for_elementor_timeline' !== $element->get_name() ) {
        return;
    }

    $settings = $element->get_settings();

    if ( isset( $settings['children'] ) && is_array( $settings['children'] ) ) {
        foreach ( $settings['children'] as $key => $value ) {   
			if ( is_array($value) && isset( $value['image']['id'] ) ) {
				$post_type = get_post_type( $value['image']['id'] );      
				if ( $post_type ) {
					$translated_id = apply_filters( 'wpml_object_id', $value['image']['id'], $post_type, true );
					$settings['children'][$key]['image']['id'] = $translated_id;
				}
			}
			
		}

        $element->set_settings( 'children', $settings['children'] );
    }
}

I tested that on my local site and found it fixed the issue.

Let me know how it goes.

The topic ‘[Closed] Media translation image doesn't show properly.’ is closed to new replies.