Skip Navigation

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

Problem:
The client needed to update a custom string in the AMP theme footer but encountered issues with the string translations not working after the update.

Solution:
We recommended the following steps:
1. Remove the custom HTML code from AMP > Settings > Advanced Settings > Enter HTML in Footer, as this code is not used for translation strings.

<footer>
<!-- Your existing footer content here -->
 
<!-- Container for the fixed button -->
<div class="amp-button-container">
    <a href="https://firstderm.com/ask-online-dermatologist/" class="amp-button">CLICK TO ASK A DERMATOLOGIST</a>
</div>
</footer>

2. Ensure that the code to register the string for translation is enabled in the

functions.php

file within the child theme folder.

function register_strings_for_translation() {
    if (function_exists('icl_register_string')) {
        icl_register_string('first-derm-footer', 'amp-button-text', 'CLICK TO ASK A DERMATOLOGIST');
    }
}
add_action('init', 'register_strings_for_translation');

3. Re-translate the string in WPML > String Translation.

After following these steps, the translation string in the footer should display correctly.

Please note that this solution might be irrelevant if it's outdated or not applicable to your case. If the issue persists, 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 you still need assistance, 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.

This topic contains 1 reply, has 2 voices.

Last updated by Long Nguyen 1 year, 2 months ago.

Assisted by: Long Nguyen.

Author Posts
March 14, 2024 at 8:29 pm #15412373

Tucango

Tell us what you are trying to do?
I need to update an custom string like we did here: https://wpml.org/forums/topic/cant-find-a-string-ti-be-translated/

Is there any documentation that you are following?
hidden link

Is there a similar example that we can see?
On my last ticket.

What is the link to your site?
Examples at:

hidden link
hidden link

After my last ticket I need to update the text. But after doing that, the strings translations don't work. What should I do?

Here are the screenshots of the AMP Theme footer, functions.php file and WPML String Translation.

Thanks

Captura de pantalla 2024-03-14 a la(s) 17.27.48.png
Captura de pantalla 2024-03-14 a la(s) 17.27.24.png
Captura de pantalla 2024-03-14 a la(s) 17.26.49.png
March 15, 2024 at 4:26 am #15412659

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi there,

Thank you for contacting WPML support, I’m happy to help you with this issue.

After reading the previous ticket and the suggestion of my colleague, I fixed the issue on your with the following steps:

1. Remove the custom HTML code in AMP > Settings > Advanced Settings > Enter HTML in Footer. This is the HTML code and is not used for translation strings.

<footer>
<!-- Your existing footer content here -->

<!-- Container for the fixed button -->
<div class="amp-button-container">
    <a href="<em><u>hidden link</u></em>" class="amp-button">CLICK TO ASK A DERMATOLOGIST</a>
</div>
</footer>

2. Enable the code to register string for translation in the file functions.php under the child theme folder

function register_strings_for_translation() {
    if (function_exists('icl_register_string')) {
        icl_register_string('first-derm-footer', 'amp-button-text', 'CLICK TO ASK A DERMATOLOGIST');
    }
}
add_action('init', 'register_strings_for_translation');

3. Re-translate the string in WPML > String Translation.

Now you can see the translation string in the footer is displayed correctly.

Looking forward to your reply.
Thanks

Cáncer en la piel de color - Lo que debes saber - 2024-03-15 11-25-16.jpg
March 18, 2024 at 12:00 pm #15420722

Tucango

Thanks for the great solution!