- This topic has 18 replies, 2 voices, and was last updated 1 year, 2 months ago by
Leon.
-
AuthorPosts
-
July 24, 2022 at 9:54 pm #2292577
Leon
Hi Team,
This is the ideal language swicher appearance I’m trying to achieve (a globe icon and the current language). https://gengo.com/
WPML built-in language swithcher doesn’t offer an option to use a global icon for all languages, so I’m trying to achieve the above effect using WPML’s “custom language switcher” shortcode and Hook Element from GPP.
But I never found a hook location that let me put it there after the primary navigation (as if the last item, and not after the whole primary nav, which will be displayed in another line)
Could you help?
Thank you!
July 24, 2022 at 10:01 pm #2292578Fernando Customer Support
Hi Leon,
Try hooking it to
generate_menu_bar_items
.If it doesn’t work, can share a link to the site in question?
You may use the private information field for this: https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information
Kindly let us know how it goes.
July 24, 2022 at 10:08 pm #2292582Leon
Hi Fernando,
I don’t see that hook. I’m using the latest version of GPP, but I’m not using Flexbox, which is probably the reason.
But if I switch to Flexbox, my webiste sort of changes layout for some areas and I had to investigate all my sites and find areas that are changed, so I’m trying not to switch to Flexbox.
Is it possible to achieve it based on my existing structure?
July 24, 2022 at 10:20 pm #2292586Fernando Customer Support
I see. With your current structure, here’s a CSS you may try adding through Customize > Additional CSS:
@media(min-width: 769px) { nav .inside-navigation.grid-container.grid-parent { display: flex; flex-direction: row-reverse; align-items: center; } }
Side note: For reference, here’s an article with regards to switching to flexbox: https://docs.generatepress.com/article/switching-from-floats-to-flexbox/
July 24, 2022 at 10:46 pm #2292593Leon
It works for the hook. But it also put my navigation logo to after the menu items…
July 24, 2022 at 10:52 pm #2292598Fernando Customer Support
How does it look like from your end? On Desktop, the logo is still on the left side, before the nav on my end: https://share.getcloudapp.com/qGuOn4Dj
On tablet, the logo is above the nav.
July 24, 2022 at 10:57 pm #2292606Leon
That’s right. I mean, the navigation menu. (you need to scrool down and up to see the menu)
July 24, 2022 at 11:01 pm #2292610Fernando Customer Support
I see. Thank you for clarifying.
Can you try this CSS instead?:
@media(min-width: 769px) { nav .inside-navigation.grid-container.grid-parent { display: flex; flex-direction: row-reverse; align-items: center; } .navigation-branding { order: 5; } }
July 24, 2022 at 11:59 pm #2292632Leon
Thank you. It’s working for desktop and pad. But for mobile, it’s still displaying incorrectly. The language switcher is somehow displayed to the left of the logo.
But on mobile, I’d like to display the language switcher either to the left of the menu icon, or to the bottom of the primary naviation items after clicking the menu icon.
Could you help on this? Thank you
July 25, 2022 at 12:31 am #2292648Fernando Customer Support
I see. Try adding this:
#mobile-header .site-logo.mobile-header-logo { order: -1; }
July 25, 2022 at 12:52 am #2292661Leon
This works for mobile. Thanks Fernando.
It’s just that the language switcher shortcode isn’t working on mobile. I’m only seeing an icon on mobile…
July 25, 2022 at 1:01 am #2292672Fernando Customer Support
Are you using the same shortcode added through an Element for mobile and desktop?
GeneratePress shouldn’t be hindering this shortcode from working. What specific hook are you using?
July 25, 2022 at 1:04 am #2292673Leon
Yes the same shortcode. Generate_after_primary_menu hook. It’s a elementor template shortcode in the hook Element, which contains the design (icon to the left and WPML language switcher shortcode to the right).
July 25, 2022 at 1:13 am #2292683Fernando Customer Support
I see. It’s weird that it isn’t working for mobile. If you add solely the WPML shortcode, does it work?
July 25, 2022 at 5:35 am #2292879Leon
Yes wierd. Anyway, I disabled the element on mobile and added the shortcode through off canvas panel, and achieved similar effect. Thank you for the help.
-
AuthorPosts
- You must be logged in to reply to this topic.