Skip Navigation

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

Problem:

The site logo was not translatable.

Solution:

1- Go to WPML-> Theme and plugins localization, select your theme, and scan
2- Go to WPML-> String Translation
3- Scroll down and click on the "Translate texts in admin screens »" link
4- Search for Logo URL and ID
5- Select the strings
6- Click on the "Add to String Translation" button
7- Then click on "the « Return to String Translation" link
8- Translate the strings, clear the cache, and check the front end

Relevant Documentation:
https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/

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.

Tagged: 

This topic contains 6 replies, has 2 voices.

Last updated by rinkd 1 year, 12 months ago.

Assisted by: Osama Mersal.

Author Posts
January 14, 2023 at 5:19 pm #12818503

rinkd

Dear sir/madam,

My theme is WPML supported, and I am trying to use the ICL_LANGUAGE_CODE hook to display a different logo for the English website. The main website is Dutch.

I am following: hidden link

Following the manual and making the adjustments in my child theme, does not change the logo at all. Does someone know what the problem is, and how to accomplish this?

Thank you for your time and efforts.

Best regards,

January 15, 2023 at 8:54 am #12820411

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

Thanks for contacting WPML forums support. I'll be glad to help you today.

Kindly try to use the "wpml_current_language" hook. (https://wpml.org/wpml-hook/wpml_current_language/)

For example:

<?php $my_current_lang = apply_filters( 'wpml_current_language', NULL );
if ($my_current_lang == 'en'): ?>
    <a class="logo_link logo_link--white" href="<em><u>hidden link</u></em>">
        <img src="<em><u>hidden link</u></em>">
    </a>
    <a class="logo_link logo_link--dark" href="<em><u>hidden link</u></em>">
        <img src="<em><u>hidden link</u></em>">
    </a>
<?php endif; ?>

Please note that we don't support custom code. Kindly check our support policy. (https://wpml.org/purchase/support-policy/)

Best regards,
Osama

January 15, 2023 at 9:24 am #12820485

rinkd

Dear mr. Mersal,

Thank you very much for your time and efforts. I have tried your piece of code, but unfortunately, the logo still does not change.

Regarding the last line of your message, does that mean you cannot help me further? If that is the case, I understand, and will need to come up with a different solution.

Best regards,
Ali

January 15, 2023 at 9:29 am #12820489

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi Ali,

Thanks for your reply. Could you please login to this sandbox site and upload your theme? (hidden link)

After that, please let me know how to reproduce the issue. I'll check it and try to find a workaround to translate the logo.

Best regards,
Osama

January 15, 2023 at 9:54 am #12820523

rinkd

Dear Osama,

Thank you for providing the link and wanting to find the issue. I have uploaded the theme and created a child theme where I have edited the specific file (wp-content/themes/myhome/includes/menu/class-myhome-menu.php). I have used an example logo, with the piece of code from the link in my first post, aswell as your code. As can be seen, it does not work for some reason.

Thank you for your time and efforts.

Best regards,
Ali

January 15, 2023 at 10:30 am #12820679

Osama Mersal
Supporter

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi Ali,

Thanks for replicating the issue. Would you please check the following steps?

1- Go to WPML-> Theme and plugins localization, select your theme, and scan
2- Go to WPML-> String Translation
3- Scroll down and click on the "Translate texts in admin screens »" link
4- Search for Logo URL and ID
5- Select the strings
6- Click on the "Add to String Translation" button
7- Then click on "the « Return to String Translation" link
8- Translate the strings, clear the cache, and check the front end

Kindly check our guide to know more about translating texts in the admin texts screen. (https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/)

Kindly check this URL to see how the logo is translated via String Translation. (hidden link)

Please check the translated home page to see if the logo is translated correctly.

Best regards,
Osama

January 15, 2023 at 10:37 am #12820855

rinkd

Wow, that worked! Thank you so much, Osama. Wish you a nice Sunday!