- This topic has 23 replies, 5 voices, and was last updated 5 years, 4 months ago by
Tom.
-
AuthorPosts
-
September 28, 2016 at 8:24 am #230105
David
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?September 28, 2016 at 12:00 pm #230141Tom
Lead DeveloperLead DeveloperHmm, 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/
December 9, 2017 at 8:03 am #445646Lisa
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 }} ?>
December 9, 2017 at 8:47 am #445681Leo
StaffCustomer SupportCan you try the
elseif
way as Tom suggested?December 11, 2017 at 2:48 am #446707Lisa
ok… yes this works now..
https://prnt.sc/hlx6nw
how do I get the logo to sit left of the header.
http://www.p8072-158-1962.s158.upress.link/en/as the primary logo sits right in the primary language
https://prnt.sc/hlx7nnDecember 11, 2017 at 8:38 am #446982Leo
StaffCustomer SupportLooks like you are wanting to use this layout here: https://docs.generatepress.com/article/navigation-logo/#navigation-as-header
December 14, 2017 at 12:44 am #449170Lisa
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/hnbkl7Hoping this is clearer.
thanks
LisaDecember 14, 2017 at 8:06 am #449443Leo
StaffCustomer SupportCan you try this CSS:
.header-aligned-right:not(.rtl) .site-header { text-align: left; }
Let us know.
December 14, 2017 at 10:15 pm #449948Lisa
great…. that did the job.
ThanksDecember 15, 2017 at 8:32 am #450299Leo
StaffCustomer SupportNo problem!
December 18, 2017 at 12:54 am #451900Lisa
Hi Leo
so I still a few issues re. the logo.I now see that I don’t have a logo on the sticky menu for English site
https://prnt.sc/hoz2xtand on the mobile menu, the logo in English is missing, I get the alt text
https://prnt.sc/hoz44hHOw do I add these?
Link to site
http://www.p8072-158-1962.s158.upress.link/en/December 18, 2017 at 5:32 am #452052Leo
StaffCustomer SupportI can see the logo fine on desktop: https://s33.postimg.org/aixfycre7/2017-12-18_0531.png
For mobile, the mobile header logo you’ve uploaded isn’t valid: http://www.p8072-158-1962.s158.upress.link/wp-content/uploads/2017/12/logo-en.jpg
Try re-uploading.
December 18, 2017 at 6:41 am #452101Lisa
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/hoz44hLisa
December 18, 2017 at 6:59 am #452168Leo
StaffCustomer SupportYour navigation english navigation logo address isn’t valid: http://www.p8072-158-1962.s158.upress.link/wp-content/uploads/2017/12/logo-en.jpg
The same image is also used in navigation logo which is also not valid.
December 19, 2017 at 12:22 am #452686Lisa
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 🙁
-
AuthorPosts
- You must be logged in to reply to this topic.