[Resolved] Change in page resets embedded form in translated page
This thread is resolved. Here is a description of the problem and solution.
Problem:
Marketo forms embeeded with Javascript cannot be translated. Solution:
- Backup the site completely first to prevent any issues.
- Edit your child theme's functions.php file and append the following code so that Numbers/IDs in page are translatable and are shown in translation editor.
We are using Marketo forms in our website and we embed it by adding a script provided by Marketo. To embed, we use a HTML block from the Gutenberg builder and since we cannot find the script in the ATE, when we localized or changed form from other languages we change it on String Translation.
The issue with this is that everytime we change the content in a page with the embed form the form get back to the english one
- Edit the page with issue in primary language and update the page by adding an extra space or character in title or content to trigger a translation update.
- Edit the translation and see if you have the form ID like 11521 available for translation. If not search in the search bar at the top in ATE then translate it.
It looks like the ID is not shown in ATE because the ID is embedded within a HTML/JavaScript code and ATE does not translates HTML codes.
In this case a custom code or a setup might be required to make the forms compatible with WPML. This out of our support scope. However I am making an exception here since minimal code might fix the issue, and providing you a custom solution below:
Can you please:
- Backup the site complete to prevent any issues.
- Add the code below ( that you added before ) in your child theme's functions.php for translating Numbers with ATE.
Updated the code with the one you've provided. I'm not sure if I did it correctly but instead of embedding the form via script I replaced it with this format [marketo_forms id="10800"]. The problem is that it does not show the form on the page however when I try to translate in ATE I was able to find the form ID. Can you please also check?
I test the solution again on a test site and it seems to work fine. I also see on your site hidden link the form is loading fine. Can you please try the solution again after clearing all browser caches and see how it goes?
If the issue persists, I would need to take a closer look at your site. So I would need to request temporary access (WP-Admin and FTP), preferably to a test site where the problem has been replicated. Also, please let me know on which page can I see the issue.
Your next answer will be private, which means only you and I have access to it.
IMPORTANT: Please take a complete backup of the site to avoid data loss.
memory
Thank you so much for looking into this. I can confirm that the form is loading on this page - hidden link. I can also see the form ID on ATE. However when I translate it the form is not showing on the translated page for example in French. Here's the link for your referece hidden link
Can you please also check again on your end. Thank you!
It looks like to embed a form the translation should be done to the Form Id in "<form id=" section Script/HTML also and not only the Form id in Script.
In the scripts I sent you please replace the code in theme functions.php for [marketo_forms] to the following, this should then fix the issue.