Site logo

Archived topic

Customize Polylang Language Switcher

11 replies · Started by María on April 26, 2019

Viewing posts 1–12 of 12

I would like to know what's the best way to customize the language switcher if I'm using the free version of Polylang.
As you can see in the attached link we already use the dropdown option. We still want to add the rectangle around the current language and change the background color of the dropdown menu too, like on this site https://nfclinguistic.com/

Thank you

Hi Leo, thanks for the reply. I understand how it works, just cannot think of a way to make it work for the Language Switcher. It's the only menu item that doesn't include the CSS Classes field. All the other items are added to menu via the "Pages" option on the left, but the Language Switcher acts as a Custom link. Is there a way to add a custom class to the Language Switcher in this case?

I added the language switcher using this "language switcher" metabox that came up on the menu on the left after I installed Polylang. The list of menu items shows it as a custom link, but with specific "language switcher" settings.
Here's the screenshot that shows it https://drive.google.com/file/d/1kJQVTyg1ilKQAxOWCxuDBifW7z3LQ9Pz/view?usp=sharing

Tried this link from their documentation but still cant figure it out https://polylang.wordpress.com/documentation/frequently-asked-questions/the-language-switcher/

Yes, CSS classes is checked. I managed to add it to the home menu item for example

Ahh looks like it already has a custom class added.

Try this:

@media (min-width:769px) {
    .main-navigation .main-nav ul li.pll-parent-menu-item > a {
        background-color: #ffffff;
        border: 2px solid #000000;
        color: #000000;
        line-height: 35px; /*this number will likely need to be adjusted*/
    }
}

Thanks a lot Leo. That works! However, it changes the style of both the current language and the dropdown menu. Is there a way to only add the border to the current language and not for the submenu? If you can please take a look at the link you can check how it looks now and see what I mean.

Yes, perfect! Thank you Leo

No problem :)

This archived topic is closed to new replies.