- This topic has 10 replies, 5 voices, and was last updated 5 years, 11 months ago by
Tom.
-
AuthorPosts
-
January 27, 2018 at 6:04 pm #481416
Adam
I create a website in 2 languages (Polish and English) using Polylang Plugin. I have added the logo to Primary Navigation but the logo link redirects to the same – polish frontpage in both language versions. As I am on the English site, it does not direct me to the frontpage in English but to Polish. I do not know if I can use any of the GPhooks filters? Or any other idea?
Hope you can help me out šJanuary 28, 2018 at 1:06 am #481501Tom
Lead DeveloperLead DeveloperHi Adam,
I wonder if a function like this might help:
add_filter( 'generate_logo_href', 'tu_english_navigation_logo_url' ); function tu_english_navigation_logo_url( $url ) { if ( ! function_exists( 'pll_current_language' ) ) { return $url; } if ( 'English' == pll_current_language( 'name' ) ) { return 'URL TO ENGLISH HOMEPAGE'; } return $url; }
Let me know š
January 28, 2018 at 5:30 am #481614Adam
Hi Tom,
Thank you for your answer.
I understand that I am going to paste this code into GP Hooks by changing only the URL TO ENGLISH HOMEPAGE. I did this and I marked Execute PHP. I tried in many fields of GP Hooks. The problem has not been solved.January 28, 2018 at 6:43 am #481658Adam
I found a solution!
It was easier than I thought. The problem was not in Theme but in Polylang settings.
Solution:
1. Go to WP Dashboard ‘Languages’ -> ‘Settings’ -> ‘URL modifications’
2. The ‘Hide URL language information for default language’ section must be unchecked -> ‘Save Changes’
I work as it should!
Maybe it will be useful to someone.Thank you and best regards
January 28, 2018 at 10:04 am #481855Tom
Lead DeveloperLead DeveloperAwesome, thanks for the sharing the solution! š
March 7, 2018 at 12:25 pm #514172alzate1985
Hi guys, enjoying your theme a lot. I wonder if you can help me disabling the link of the nav menu logo. On the other hand, I need to know where or how to change the link of the image, in case I need to link somewhere else.
Thanks so much!!
March 7, 2018 at 4:03 pm #514274Leo
StaffCustomer SupportHi there,
Can you start a new topic?
Thanks!
September 22, 2019 at 4:13 am #1015756Leo
Hi!
Iām having the same issue with the logo link for different languages usingĀ Polylang. Unfortunately, I cannot use the easy solution posted by Adam, so I tried the function suggested by Tom.Ā
I made a GPĀ Element like this:
add_filter(Ā āgenerate_logo_hrefā, ātu_english_navigation_logo_urlā );
function tu_english_navigation_logo_url(Ā $urlĀ ) {
Ā Ā if (Ā ! function_exists(Ā āpll_current_languageā ) ) {
Ā Ā Ā Ā return $url;
Ā Ā }Ā Ā if (Ā āEnglishā == pll_current_language(Ā ānameā ) ) {
Ā Ā Ā Ā return āhttps://www.ruskus-patruskus.com/en/ā;
Ā Ā }Ā Ā return $url;
}I placed it “before_logoāĀ (I tried other locations but it doesnāt work and the code lines shows up on the pages). IĀ marked āExecute PHPā and in Display Rules > Location IĀ choseĀ āEntire Siteā.
However, itās not working. What am I doing wrong?
Thanks in advance. š
September 22, 2019 at 10:27 am #1016024Tom
Lead DeveloperLead DeveloperInstead of adding it as an Element, add it using one of these methods: https://docs.generatepress.com/article/adding-php/
Let me know if you need more info š
September 23, 2019 at 6:30 am #1016599Leo
It worked! I added it using Code Snippets, and now it works perfectly. Thank you very much, Tom! š
September 23, 2019 at 10:07 am #1016912Tom
Lead DeveloperLead DeveloperYou’re welcome š
-
AuthorPosts
- You must be logged in to reply to this topic.