Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

WPML Language Switcher Position in Header on Tablet/Mobile

  • I created a GeneratePress element called WPML Language Switcher with a shortcode for a custom WPML language switcher. I want to display it in the header on tablet and mobile.

    I used the before_navigation hook, but it still shows after the hamburger menu icon. I want it to appear before the hamburger icon, as shown in screenshot 2. In screenshot 1 you can see the current state.

    Can you help me position it correctly?

  • Hi there,

    Try using menu_bar_items hook instead.

  • I changed the hook to the one you suggested (menu_bar_items). However, after updating it, the element is no longer visible on the front end.

    When I checked the source code, I noticed that the .menu-bar-items <div> has display: none. If I manually change it to display: block, the WPML language switcher appears in the correct position but then both the menu label and the hamburger icon are displayed twice.

    How can this be fixed? View attached screen recording for reference.

  • The menu_bar_items hook should not be set to display:none by default, based on what I see, it’s been set to display:flex:
    https://app.screencast.com/9Yp4VgOFpeWON

    However, the language switcher has been set to display none as it has ul tag.

    So you will need this css:

    .inside-header .menu-bar-items .wpml-ls ul {
        display: block;
    }
  • This fixed everything.

    Looks exactly how I wanted now. Thank you!

  • You are welcome   🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.