This thread is resolved. Here is a description of the problem and solution.
Problem: The client needed to translate the text "CLICK TO ASK A DERMATOLOGIST NOW" visible on AMP pages, which was entered using an HTML tag inside the AMP Plugin.
Solution: We found that the HTML box where the client added the HTML content was not configured to display translated HTML on the frontend. To solve this, we followed the steps in the provided documentation and inserted a specific code snippet into the Footer template of the "Design 2" template used by the AMP for WP plugin. The path to the file is
. After adding the code and translating the button text via String Translation, the text displayed correctly in Spanish on the frontend.
We also advised the client that any updates to the AMP plugin would overwrite these custom changes. To prevent this, we suggested two alternatives: 1) Use the Hook provided by the AMPforWP plugin to append the code to the footer by adding it to the
functions.php
file of the theme. 2) Create a custom footer template within a child theme for the necessary customizations. Both alternatives help ensure that modifications remain intact after plugin updates. For more information on hooks and creating a custom template, we recommended consulting the AMPforWP tutorials:
If the solution provided here is not relevant due to being outdated or not applicable to your case, we highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If further assistance is needed, please open a new support ticket.
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.
I understand what you're looking for and will try my best to assist you in this matter.
The instructions provided in the documentation for translating the string are accurate. To enable proper translation from the String Translation, it's necessary to update the AMP template with the code provided in the documentation(Screenshot: hidden link).
However, based on the screenshot you shared, it appears you have HTML content in the Footer. To achieve translation for this section, the entire HTML block needs to be translated. Please follow these steps and update me on the outcome:
1. Navigate to WPML > String Translation. Scroll to the bottom and click on the link titled "Translate texts in admin screens »".
2. In the search field, type: [redux_builder_amp].
3. Search for the option named "[redux_builder_amp]amp-footer-text-area-for-html". You might need to navigate using the pagination to find this option.
4. When found, select this option and add it to the String Translation list.
5. Return to WPML > String Translation, and you should see the HTML content listed there. Click on the "+" icon to add your translation. You can copy the entire HTML block into the translation field and simply modify the text portion as needed. For guidance, refer to this screenshot: hidden link
It appears that PHP code has been added to an HTML box. If PHP code support is not enabled for the HTML box, the PHP code will simply appear as plain text on the frontend.
If you wish to set the button's name using PHP, it would be advisable to consult the support team of the AMP plugin that you're using for guidance on how to properly embed PHP code so that it works as intended. By using the 'wpml_translate_single_string' hook, the button's name will become eligible for translation and you'll be able to translate the name from the String translation section.
If the approach of adding the button name through HTML is suitable for your needs, I recommend continuing with this method and translating the entire HTML code block through the String Translation, as outlined in my previous message.
I hope you can understand. Please feel free to let me know if you need further assistance in this matter. I will be happy to help.
The AMP plugin that you're using has an extension for WPML, which is required to achieve full multilingual compatibility. Please check the links below for more details:
From the WPML Debug Info, I noticed that the extension is currently not active on your site. Would you kindly activate the extension and then check again?
Let me know the update. I will be happy to help if you need further assistance in this matter.
Hello There,
I hope you're doing well. Sorry for the delay in responding due to the weekend.
Thank you for patiently trying out the suggestions. As the issue persists, a closer inspection will be required to understand the root cause of the issue.
I want to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better to have a testing site where the issue is replicated.
You will find the needed fields below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.
Maybe I'll need to replicate your site locally. For this, I’ll need to temporarily install a plugin called “Duplicator” or "All in One WP Migration" on your site. This will allow me to create a copy of your site and your content. Once the problem is resolved I will delete the local site. Let me know if this is ok with you.
IMPORTANT
-Please backup site files and database before providing us access.
-If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this: hidden link
Hello There,
Thank you for sharing the access information.
I've conducted an in-depth analysis of the issue and discovered a solution for translating the button text. During the investigation, I found that the HTML box, where you've added the HTML contents is not been configured to display translated HTML in the frontend. Therefore, The viable method for translating the text, is outlined in the documentation that you've shared while creating the ticket
- hidden link
Based on the provided documentation, it was necessary to insert a particular code snippet into the Footer template utilized by the AMP for WP plugin. Since you opted for the "Design 2" template for the AMP version, I accessed and edited the footer template of this specific AMP template at "wp-contents/plugins/accelerated-mobile-pages/templates/design-manager/design-2/footer.php". After adding the required code, I translated the button text from String translation.
This adjustment resulted in the button text being accurately displayed in the Spanish version of the site on the front end. Please check this screenshot for a better understanding: hidden link
To ensure the button text is correctly displayed in different language versions of the site, please translate the button text into the respective languages.
Let me know if there is anything else if you need help with. I will be happy to assist.
Because the code is directly embedded in the plugin file, any updates to the plugin will overwrite the custom changes. You have two alternatives to consider:
1) Use the Hook provided by the AMPforWP plugin to append the code to the footer. By adding the hook code to the functions.php file of your theme, your changes will always be there even after plugin updates. For information on the available hook to insert code into the Footer, please refer to the following link:
- hidden link
2) Develop a custom footer template within your child theme for the necessary customizations. This approach ensures that your modifications remain intact regardless of plugin updates. For guidance on this process, consult the instructions in their tutorial at the link below:
- hidden link
If you require further assistance with the hooks or creating a different template, do not hesitate to contact the AMPforWP plugin support team. They should be able to offer detailed advice on integrating code into the AMPforWP plugin's Footer template.
I hope you can understand. Please feel free to let me know if there is anything else if you need help with. I will be happy to assist.
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.