Site logo

Archived topic

Polylang language switcher

8 replies · Started by Martin K Lønne on March 23, 2020

Viewing posts 1–9 of 9

Hi!
We have the GP premium upgrade and are wondering if there is a PHP hook to add the Polylang menu switcher as a wordpress menu item? So it is integrated in the menu, and not in the header.

Hi!
Here is the url:
emmany.wpengine.com

It is wanted at the end of the navigation like this:

Try this CSS:

@media (min-width: 769px) {
    .inside-navigation {
        display: flex;
        align-items: center;
        flex-direction: row-reverse;
    }
}

Nice solution! Did not think about row-reverse. How about mobile layout? is there another hook for mobile menu?

For the Mobile header there is inside_mobile_header or you could just disable the Mobile Header.

Hi!
If you check the link again, the hook does not work correctly for the mobile menu.

function addLanguageSwitcher() {
	pll_the_languages(array('dropdown'=>1)); 
}

add_action( 'generate_inside_navigation', 'addLanguageSwitcher');
add_action( 'inside_mobile_header', 'addLanguageSwitcher');

Solved this, seems polylang has a quite hidden option to simple add the language switcher as a menu item.
Thank you!

Awesome - thanks for letting us know.

This archived topic is closed to new replies.