- This topic has 19 replies, 3 voices, and was last updated 2 years, 9 months ago by Tom.
-
AuthorPosts
-
May 19, 2020 at 2:10 am #1291421Christoph
We are using Generate Press and WPML, for a website in spanish and english. We are using for each language a different domain:
Spanish: http://www.concepto3s.com
English: http://www.3hconcept.com(1) Different Logo each language:
I tried with ELEMENTS a Hook for all the website, before logo and this code<?php if ( ICL_LANGUAGE_CODE == 'en' ) { ?> <img src="http://www.concepto3s.com/wp-content/uploads/2020/05/3hconcept-web.jpg" alt="" /> <?php } else { ?> <img src="http://www.concepto3s.com/wp-content/uploads/2020/05/concepto3s-web.jpg" alt="" /> <?php } ?>
to show a different logo depending on the language (as I found in another Support Topic). But now, there is no logo shown, not in spanish, not in english.
(2) Would it be possible also to use a different FAVICON depending on the language? and
(3) Also using a different “Copyright Content” depending on the language?May 19, 2020 at 9:55 am #1292365TomLead DeveloperLead DeveloperHi there,
Is it the same WordPress installation with two different domains?
What kind of logo setup are you using by default? Have you simply added it through Customize > Site Identity?
May 19, 2020 at 10:47 am #1292447ChristophHi, hello,
yes, the same WordPress installation with 2 domains. The WPML Tutorial:
https://wpml.org/tutorials/2016/04/use-wpml-different-domains-per-language/Yes, by default the spanish logo by Customize > Site Identity.
May 19, 2020 at 4:44 pm #1292891TomLead DeveloperLead DeveloperGive this function a shot:
add_filter( 'generate_logo', function( $logo ) { if ( ICL_LANGUAGE_CODE == 'en' ) { return 'URL TO ENGLISH LOGO'; } return $logo; } );
Let me know ๐
May 20, 2020 at 1:08 am #1293276ChristophI am not sure, where and how to add this function.
May 20, 2020 at 3:44 am #1293455DavidStaffCustomer SupportHi there,
this article explains how to add that PHP snippet:
May 20, 2020 at 5:40 am #1293635ChristophOk, now it shows this error:
Warning: Use of undefined constant CL_LANGUAGE_CODE – assumed ‘CL_LANGUAGE_CODE’ (this will throw an Error in a future version of PHP) in /var/www/web1780/html/wp-content/plugins/code-snippets/php/snippet-ops.php(446) : eval()’d code on line 2
May 20, 2020 at 2:19 pm #1294481TomLead DeveloperLead DeveloperCan you try the updated code?: https://generatepress.com/forums/topic/elements-depending-on-language-with-wpml/#post-1292891
May 21, 2020 at 1:06 am #1294932ChristophYes, this is the code I used.
Screenshot: https://drive.google.com/file/d/1U9QWbFtuclFayGa2UrykTjfvCWllUcDh/view?usp=drivesdk
May 21, 2020 at 9:38 am #1295680TomLead DeveloperLead DeveloperI actually made a change to it – can you try the updated code?
May 21, 2020 at 11:24 am #1295799ChristophYes, this updated code works. Thanks!
May 21, 2020 at 3:16 pm #1296012TomLead DeveloperLead DeveloperYou’re welcome ๐
June 30, 2021 at 8:04 am #1839940SerhiiHello, Team!
I use this code:
add_filter( 'generate_logo', function( $logo ) { if ( ICL_LANGUAGE_CODE == 'en' ) { return 'URL TO ENGLISH LOGO'; } return $logo; } );
It works well for me. But i also have on my site logo on sticky menu – inside div with class=”sticky-navigation-logo”.
How to change logo on sticky menu?
I use GP Premium and WPML. My site will have three logos: russian, english and ukrainian.June 30, 2021 at 8:56 pm #1840482ElvinStaffCustomer SupportHi Serhii,
I’m not sure I fully understand what you mean.
To clarify:
Does the sticky menu logo have to be different w/ the static menu logo? Meaning it changes logo when you scroll down?
July 1, 2021 at 9:32 am #1841329SerhiiNo, the sticky menu logo must be the same as the static menu logo.
Both types of logo should change depending on the language of the site.The above code only works for the static menu logo.
I need some code that will change also sticky menu logo when switching site display language. -
AuthorPosts
- You must be logged in to reply to this topic.