Polyglot: how to show both language name and flag

So here we go with tip #2 for this great plugin. I wanted to show both the flag and the name of available languages on my wordpress sidebar. The function responsible for checking available languages is polyglot_list_langs, which I had to modify a little bit to suit my needs. Ok, let’s stop talking and start coding 🙂

– Enter WordPress Administration Area
– Edit Polyglot Plugin ( Plugins -> Polyglot -> Edit).
– Look for polyglot_list_langs function (~ line no. 487)
– Look for this line of code (near the end of the function, ~ line no. 544)

– Replace that line with the following code block (yeah, I know that’s not very elegant)

– Ok, we’re almost done. Now you can simply call polyglot_list_langs(2) to make it show the flag and language name 😉 To get it working in our wordpress sidebar we need to look for the function called in widget_polyglot (around line 911) and change its argument from $listtype (which wasn’t working for me) to 2.

We made it, now polyglot will please us with its flags and language names 😉 Any feedback is apreciated (even cursing me for my italo-english 🙂 ) !