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)

echo "\">". (($flags) ? "<img src=\"".$polyglot_settings['path_to_flags'].$polyglot_settings['flags'][$value] ."\" alt=\"".get_trans($value)."\" title=\"".get_trans($value)."\" />" : get_trans($value)) ."</a></li>";

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

if($flags == 2)
	echo "\"><img src=\"".$polyglot_settings['path_to_flags'].$polyglot_settings['flags'][$value] ."\" alt=\"".get_trans($value)."\" title=\"".get_trans($value)."\" /> ".get_trans($value)."</a></li>";
else
	echo "\">". (($flags) ? "<img src=\"".$polyglot_settings['path_to_flags'].$polyglot_settings['flags'][$value] ."\" alt=\"".get_trans($value)."\" title=\"".get_trans($value)."\" />" : get_trans($value)) ."</a></li>";

- 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 :) ) !