Site logo

Archived topic

Site Identity and WPML

23 replies · Started by David on September 28, 2016

Viewing posts 1–15 of 24

Hi GP support -

I have a bilingual website.
I need to display the logo in Customizer --> Site Identity --> Logo (image) based on the language.
Is this possible?

Hmm, I think you would need to use GP Hooks and not the logo uploader in the Customizer.

According to WPML, you can use PHP to see which language is being set.

For example, you would add this into the Before Header Content hook:

<?php if ( ICL_LANGUAGE_CODE == 'en' ) { ?>
 
    <img src="URL TO ENGLISH LOGO" alt="" />
 
<?php } elseif ( ICL_LANGUAGE_CODE == 'ja' ) { ?>
 
    <img src="URL TO JAPANESE LOGO" alt="" />
 
<?php } else { ?>
    
    <img src="URL TO LOGO IF NO LANGUAGE IS DEFINED" alt="" />

<?php } ?>

Then make sure you check the "Execute PHP" checkbox.

I found these definitions here: https://wpml.org/forums/topic/conditional-tags-based-on-which-language-the-page-shows/

HI Tom
I was connected to this page from WPML support.
I have added this PHP code in the GP hooks while also removing the logo from the customization tab.
Both languages are showing both logos. This is the page.
http://www.p8072-158-1962.s158.upress.link/
Below is the php code that I have placed.
How can I fix this?

<?php
if(ICL_LANGUAGE_CODE=='he'){ ?>
 
    <img src="http://www.p8072-158-1962.s158.upress.link/wp-content/uploads/2017/12/logoh.jpg" alt="hebrew logo" />
 
<?php }
if(ICL_LANGUAGE_CODE=='en'){ ?>
 
    <img src="http://www.p8072-158-1962.s158.upress.link/wp-content/uploads/2017/12/logo-en.jpg" alt="english logo" />
 
<?php }} ?>

Can you try the elseif way as Tom suggested?

HI Leo
Thanks for your help... but I think that you are sending me in the wrong directions to fix this... and could mess up the header completely.

1. My primary language banner is good/working - see screen capture. https://prnt.sc/hlx7nn
2. The secondary language in English - the banner is 90% ok... what needs fixing is the alignment left of the logo
what it looks like now.. https://prnt.sc/hlx6nw > this is what I need it to look like.. https://prnt.sc/hnbkl7

Hoping this is clearer.

thanks
Lisa

Can you try this CSS:

.header-aligned-right:not(.rtl) .site-header {
    text-align: left;
}

Let us know.

great.... that did the job.
Thanks

No problem!

HI Leo
I will explain again...
The sticky menu is missing the logo in english lan (secondary language) SEE SCREEN SHOT - https://prnt.sc/hoz2xt
ON the mobile site the English Lan is missing the logo to - SEE SCREEN SHOT - https://prnt.sc/hoz44h

Lisa

OK . I understand.... so I'm getting closer.
sticky menu English lan in now ok on desktop :)

the English menu now appears on the mobile site BUT it has also overridden the primary language logo in the hebrew site...i.e. both languages have English logo on mobile site.

Lisa

p.s so sorry to have all these issues :(

This archived topic is closed to new replies.