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 thread is resolved. Here is a description of the problem and solution.

Problem:
I need to change the logo according to the active language on Newsmag Theme.
Solution:
#1 Please add the following XML config to WPML -> Settings -> Custom XML Config:

<wpml-config>
    <admin-texts>
        <key name="td_010">
            <key name="tds_logo_on_sticky"/>
            <key name="tds_logo_upload"/>
            <key name="tds_logo_upload_r"/></key>
    </admin-texts>
</wpml-config>

2# Now you can translate the Logo URL (copied from Media) directly in WPML String Translation with the texdomain " admin_texts_td_010". (TD mean tagDiv, the plugin Author)

Relevant Documentation:
https://wpml.org/documentation/support/language-configuration-files/#admin-texts

This topic contains 9 replies, has 2 voices.

Last updated by Boris 1 month, 2 weeks ago.

Assigned support staff: Marcel.

Author Posts
August 28, 2019 at 8:24 am #4471939

Boris

Hi,

for one of my clients, I am working with the Newsmag theme (which is WPML compatible), and I need to change the logo according to the active language. I did some research, checked whether I could change the logo per language in the theme settings, but only one image at a time is saved, regardless of the selected flag. I also checked for any admin strings containing the word 'logo', but that does not exist.

That leaves me with the option to change the code where the logo is called, and thus create a string manually.

I found this article: https://wpml.org/forums/topic/different-logo-in-each-language/

Where one of your supporters made some changes to the code so the string would be added.

I've tried to adapt the code to the header.php in the Newsmag theme, but I cannot find how I should change this. Can you please help me adjust the code so I can change the logo per language via the string translations?

This is the part of the header.php where the logo is called:

<div class="td-header-sp-logo">
<?php
$td_logo_text = get_bloginfo('name');
$td_tagline_text = get_bloginfo('description');

if ( !empty( $td_logo_title ) ) {
$td_logo_title = ' title="' . $td_logo_title . '"';
}

// H1 on logo when there's no title with H1 in page
$td_use_h1_logo = false;
if ( is_home() ) {
$td_use_h1_logo = true;
}
?>
<div class="td-logo-text-container">
<?php if($td_use_h1_logo === true) { echo '<h1 class="td-logo">'; }; ?>
<a class="td-logo-wrap" href="<?php echo esc_url(home_url( '/' )); ?>">
<span class="td-logo-text"><?php if(!$td_logo_text) { echo "NEWSMAG"; } else { echo esc_attr( $td_logo_text ); } ?></span>
</a>
<?php if($td_use_h1_logo === true) { echo '</h1>'; }; ?>
<span class="td-tagline-text"><?php if(!$td_tagline_text) { echo "DISCOVER THE ART OF PUBLISHING"; } else { echo esc_attr( $td_tagline_text ); } ?></span>
</div>
</div>
</div>

Kind regards,
Boris

August 28, 2019 at 9:22 am #4472735

Boris

Hi Marcel,
I'm not sure what is happening with the ticket now, but last time I didn't know about the chat and it was closed before I could respond. Do I understand correctly that this ticket will now be handled via email instead of chat? That is fine with me, just making sure.
Regards,
Boris

August 28, 2019 at 10:23 am #4473265

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+02:00)

Hi Boris,

Thank you for contacting WPML Support. Yes, I transformed the chat into this ticket, as a message appeared that you are not connected to the chat anymore.

In the Newsmag Theme, there should be the possibility to translate the Admin Strings using the textdomain "theme_Newsmag": https://wpml.org/forums/topic/text-footer-logo-newsmag-theme/

You can try to make it translatable using this way: https://wpml.org/forums/topic/using-a-different-logo-per-language/

Please let me know if it worked for you.

Best Marcel

August 28, 2019 at 12:03 pm #4474089

Boris

Hi Marcel,
i searched through the admin strings, with "newsmag", "news", "theme" and "logo", but no results. The string is not there...
Regards,
Boris

August 28, 2019 at 2:52 pm #4475249

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+02:00)

I would need to request temporary access (WP-Admin and FTP) to your site
– preferably to a test site where the problem has been replicated if possible –
in order to be of better help and check if some configurations might need to be changed

Your next answer will be private which means only you and I have access to it.

❌ Please backup your database and website ❌

✙ I would additionally need your permission to de-activate and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important.

✙ Please add the Links to the […] Edit Screen, the Page/Post where you insert the […] and the corresponding Front End Page/Screen

August 29, 2019 at 10:01 am #4479721

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+02:00)

Hi Boris,

I was able to change the logo over the Admin Stings:

Working Demo: hidden link

#1 Please add the following XML config to WPML -> Settings -> Custom XML Config:

<wpml-config>
    <admin-texts>
        <key name="td_010">
            <key name="tds_logo_on_sticky"/>
            <key name="tds_logo_upload"/>
            <key name="tds_logo_upload_r"/></key>
    </admin-texts>
</wpml-config>

2# Now you can translate the Logo URL (copied from Media) directly in WPML String Translation with the texdomain " admin_texts_td_010". (TD mean tagDiv, the plugin Author)
You can check directly my Sandbox hidden link

Best Marcel

August 29, 2019 at 11:59 am #4480595

Boris

Hi Marcel,
that sounds perfect, thank you! I just tried it, but for some reason the rescanning of the child theme cannot finish, so the strings are not inventoried. I will ask my client if they can fix that first and will get back to you asap.
Regards,
Boris

August 29, 2019 at 12:14 pm #4480749

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+02:00)

Hi Boris,

sure, just let me know.

Best Marcel

September 3, 2019 at 12:06 pm #4504235

Boris

I just tested it Marcel, and it's working like a charm! Thanks a lot for your help!

September 4, 2019 at 8:07 am #4508919

Boris

Hi Marcel,
sorry, I have to re-open this ticket, as I just found out that it is not working yet with the logo on mobile screens. Can you explain to me how you came by the key names for the XML config, so I can add the mobile logo as well?
Regards,
Boris