Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client was experiencing an issue where HTML code within an Elementor Pro HTML widget was appearing on the translation page, and the client was being forced to translate it.
Solution:
We recommended moving the code from the Elementor HTML widget to the

functions.php

file of the client's Child Theme. We provided the following code to correctly add JavaScript to the theme, which prevents the Advanced Translation Editor (ATE) from confusing HTML and script code:

function custom_jquery_script() {
    ?>
    <script type="text/javascript">
        jQuery(document).ready(function() {
            jQuery('#voltar').on('click', function() {
                window.history.go(-1); 
                return false;
            });
        });
    </script>
    <?php
}
add_action('wp_footer', 'custom_jquery_script');

After applying this change, the English version should display correctly and execute the JavaScript code without it appearing in the translation editor.

If this solution does not apply to your case, or if it seems outdated, we highly recommend checking the related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. Should you need further assistance, please do not hesitate to open a new support ticket in our support forum.

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.

This topic contains 7 replies, has 2 voices.

Last updated by Christopher Amirian 9 months, 1 week ago.

Assisted by: Christopher Amirian.

Author Posts
February 21, 2024 at 7:14 pm #15330091

claudiaP-16

Hi
I'm using Elementor Pro and used html widget to use some code. I don´t need to translate it but it is showing on translation page and it is forcing me to translate it. How can solve this?
Site is under development.
Thank you

chrome_XUipwOOvOO.png
February 22, 2024 at 3:46 pm #15334569

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,.

You can simply click the COPY button in the screenshot you mentioned (check my screenshot) and save the translation when it is 100% complete and it should work ok.

Thanks.

Screenshot 2024-02-22 at 19.45.06.png
February 23, 2024 at 12:07 pm #15337528

claudiaP-16

Hi, it's not working. please check the video I made
hidden link

It returns this error:

Translation not saved
The translation cannot be empty. Enter translation and try again.

February 24, 2024 at 9:37 am #15340092

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

Thank you, I'd appreciate it if you could give me the URL/User/Pass of your WordPress dashboard after you make sure that you have a backup of your website.
It is absolutely important that you give us a guarantee that you have a backup so if something happens you will have a point of restore.

Make sure you set the next reply as private.

ALso please give us the link to the page that the issue is happening so we can check.

Thanks.

February 26, 2024 at 8:26 am #15342652

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

Thank you for the login info.

As you used Javascript code inside the HTML element the ATE could not show it in the left pane but it showed at the top right of the screen.

I just copied that from there and added it to the translated version and it worked.

Please check the screenshot.

Screenshot 2024-02-26 at 12.24.29.png
February 26, 2024 at 5:27 pm #15345659

claudiaP-16

Hi Christopher,
This code translation is visible in the frontoffice...
please see attached image
Thnak you

chrome_T9OBZF7o4r.png
February 26, 2024 at 10:25 pm #15346617
claudiaP-16

Also, if you could help me in another issue I'll apreciate it. I have a custom type (Tours) created with ACF and it has the featured image. The translations are working fine. When the featured image is added, it appears in the translated pages. But if the featured image is changed in the meantime, it is not updated in the translated pages.
E.g. hidden link on this tour I have updated the featured image that appears on the banner, but the EN and ES versions is still showing the old image, as you can see at hidden link and hidden link. How do I get them to update?
Note that there are some images that have been changed to be different depending on the page, such as the word cloud that appears on the homepage.
Thank You!

New threads created by Christopher Amirian and linked to this one are listed below:

https://wpml.org/forums/topic/split-how-to-make-feature-image-changes-reflect-in-translation/

February 27, 2024 at 11:42 am #15348937

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

I moved the code from Elementor to the functions.php of your Child Them,e and added the cde below:

function custom_jquery_script() {
    ?>
    <script type="text/javascript">
        jQuery(document).ready(function() {
            jQuery('#voltar').on('click', function() {
                window.history.go(-1); 
                return false;
            });
        });
    </script>
    <?php
}
add_action('wp_footer', 'custom_jquery_script');

This is how to correctly add a Javascript code to the Theme to avoid confusing ATE with HTML and Script code.

Now if you check the English version it shows correctly and performs the Javascript code.

We Answer one question per ticket to keep things organized and serve you better and ti is fair to our other customers. I will create a new ticket for the second question.

Thanks.

February 27, 2024 at 4:16 pm #15350097

claudiaP-16

Ok, thank you!