Site logo

Archived topic

Trouble with polylang on mobile menu

5 replies · Started by supazena on November 3, 2021

Viewing posts 1–6 of 6

Hi,
A first, I want to say GeneratePress is my favorite WP theme. It's a very nice job you do!!!

Here is situation and trouble:

I use Polylang for 2 language on my WP.
Primary language available on mydomain.com
Secondary is english version available on mydomain.com/en

I put flag on the menu and all works very fine except one thing.
You have to know I use font for my main logo on desktop and mobile version (no image for my logo).

On desktop : if I switch to secondary language then clic on the name of my site (logo), site load secondary language homepage (mydomain.com/en) and it's fine.
On mobile : if I do the same exact way, site load primary language home page (mydomain.com instead mydomain.com/en), here is my trouble.

Do you have any idea to solve this issue ?

Regards
Greg, France

Hi Greg,

Can you give this PHP snippet a try:

add_filter( 'generate_logo_href','tu_add_custom_logo_href' );
function tu_add_custom_logo_href( $url ) {
     if ('en_GB' === get_locale()) {
	  return '/en';
	}
	return $url;
}

Adding PHP: https://docs.generatepress.com/article/adding-php/

Let me know :)

Hi Ying,

Thank you for your message, snippet set into functions.php the active child theme but has no effect.
In mobile, when I am on an english page then clic my text logo = I go to the FR homepage instead EN.

I let the code into functions.php for the moment.

Regards

Ah sorry, I mistakenly thought the site title was a logo, then try this snippet instead:

add_filter( 'generate_site_title_href','tu_add_custom_site_title_href' );
function tu_add_custom_site_title_href( $url ) {
     if ('en_GB' === get_locale()) {
	  return '/en';
	}
	return $url;
} 

Let me know :)

👌 Perfect, thanks you so much !

You are welcome :)

This archived topic is closed to new replies.