Polylang is a great WordPress plugin for translation. Recently, while I was developing Yellow Door a multi-lingual website in WordPress for Rarus Agency, I felt the need of custom HTML markup for the language switcher. Since the Yellow Door website was being made using BEM methodology, Polylang’s default markup for languages doesn’t fit the scenario. So, I have taken some extra time and wrote a PHP function that returns the Polylang languages using a custom markup with BEM approach alongside its SCSS styling.
Here’s the gist URL: https://gist.github.com/zeshanshani/fade1ba03e7d35a2542ef1eabe92becf
and the code:
what i need to do with those 2 files to run your customization on me website ?
@Adam, the PHP code from this file: https://gist.githubusercontent.com/zeshanshani/fade1ba03e7d35a2542ef1eabe92becf/raw/412745bf30a72d9a03fa65c434ab979c3551cbea/polylang_custom_language_switcher.php will go into your theme/child theme’s functions.php file. And the CSS code from this file: https://gist.githubusercontent.com/zeshanshani/fade1ba03e7d35a2542ef1eabe92becf/raw/412745bf30a72d9a03fa65c434ab979c3551cbea/polylang_custom_language_switcher.css will go in your theme’s style.css file or alternatively you can put it under “WP Admin > Appearance > Customize > Custom CSS”.
Let me know if face any trouble. 🙂