- This topic has 10 replies, 5 voices, and was last updated 4 years, 6 months ago by Tom.
-
AuthorPosts
-
January 27, 2018 at 6:04 pm #481416Adam
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 #481501TomLead 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 #481614AdamHi 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 #481658AdamI 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 #481855TomLead DeveloperLead DeveloperAwesome, thanks for the sharing the solution! đ
March 7, 2018 at 12:25 pm #514172alzate1985Hi 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 #514274LeoStaffCustomer SupportHi there,
Can you start a new topic?
Thanks!
September 22, 2019 at 4:13 am #1015756LeoHi!
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 #1016024TomLead 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 #1016599LeoIt worked! I added it using Code Snippets, and now it works perfectly. Thank you very much, Tom! đ
September 23, 2019 at 10:07 am #1016912TomLead DeveloperLead DeveloperYou’re welcome đ
-
AuthorPosts
- You must be logged in to reply to this topic.