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: