I saw one of the interesting discussion topic on the WPML Forum about the same thing with the title of this article. By accidentally, I have just modified the custom footer language switcher for one of my websites that using multilingual feature, and also wrote the similar article about it a few days ago on this my blog. Thanks for the topic on the forum, so I can do some exploration in order to implement the solution for the question that has been asked on the forum. So here is the solution I made for it.
-
Open your functions.php file that usually located inside you theme’s root directory, and then add this function code:
// In order to display language selector of WPML plugin in footer/header of theme function languages_list_footer(){ $languages = icl_get_languages('skip_missing=0&orderby=code'); if($l['icl_lso_native_lang']){ $lang_native_hidden = false; }else{ $lang_native_hidden = true; } if($l['icl_lso_display_lang']){ $lang_translated_hidden = false; }else{ $lang_translated_hidden = true; } if(!empty($languages)){ echo '<div id="lang_sel_footer">'; // <-- adjust this "lang_sel_footer" with the style that exists in language-selector.css file that belongs to WPML plugin (based on the version you are currently using). foreach($languages as $l){ if($l['country_flag_url']){ echo ' <a href="'.$l['url'].'">'; echo '<img src="'.$l['country_flag_url'].'" height="12" alt="'.$l['language_code'].'" width="18" /> '; if(!$l['active']) echo '</a> '; } echo ' <a href="'.$l['url'].'">'; echo icl_disp_language($l['native_name'], $l['translated_name'],$lang_native_hidden); if(!$l['active']) echo '</a> '; } echo '</div>'; } }
Since I used WPML version 1.8.0, then I use lang_sel_footer style that exists in sitepress-multilingual-cms/res/css/language-selector.css file. Please adjust with the style that exists in the related .css file of your WPML.
-
Open your header.php file that usually located inside your theme’s root directory, and add this following code below the .css call:
<link rel="stylesheet" href="<?php echo WP_PLUGIN_URL; ?>/sitepress-multilingual-cms/res/css/language-selector.css" type="text/css" media="all" /> <?php languages_list_footer(); ?>
For example, if you use the TwentyTen theme, then you can put that code above after this following code:
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
- Now refresh or reload your site, then you should see now at the very top of your page, that custom footer language switcher appears as we want. If the style does not look good at yours, then the problem is usually caused by the style of the language switcher. Please read and follow the first step above carefully.
Have a nice code everyone, and hopefully this will be helpful!

Hi there,
I’m afraid I brought myself into trouble here.
Tried to follow your instructions here above.
However, after adding the code in the functions.php, a whole lot of code was shown on top of my website (you can see it if you go there).
So I thought “well, that’s logical, I didn’t finish the proces yet”.
You wrote “Since I used WPML version 1.8.0, then I use lang_sel_footer style that exists in sitepress-multilingual-cms/res/css/language-selector.css file. Please adjust with the style that exists in the related .css file of your WPML.”
I tried to find what you are talking about (I’m not a coder) but couldn’t find it.
So I thought, well let’s go back to the original version. So I deleted the code again in functions.php expecting everything to go back to normal again (with the language switcher at the botton of my page… But I couldn’t anymore. My site was gone, the only thing left was code…
Could you help me out here?
Thanks!
Ferd de Bruijn
Just ftp’d my original function.php to replace the ‘corrupted’ one.
My site is functioning again. But still… I still would like my language switcher on top of my page…
Actually, I’d like to have it as a dropdown in the menu bar… any suggestions?
thanks!!!!!
The same problem here!
FTP savior…
IT’S WORKING!
D Thanks for posting.
I’ve done everything like written above.
Only one thing I can not figure out is changing font color.. I mean languages names font. It’s still black.
I can change background color, frame, but not font..
Please give me some advice
This works! I’m a total newbie, can’t believe I’ve just pulled it off. Thanks again.
Hi there,
Thanks a lot for your solution!!! It works perfectly!!!
I have a question. Is it possible that the language switcher could be displayed without the flags?
I’m not an expert programmer and i’m afraid if i change something in the css the whole thing won’t work anymore.
Much thanks!
@eva polka
If you want to remove the flags, simply replace this code:
with this following:
But I recommend you not to edit that code. Alternatively, simply adjust the setting related to the displayed flags from “WPML” -> “Languages” from your wp-admin, uncheck the “Flags” from “What to include in the language switcher” section.
@Masino Sinaga
Thanks again Masino!
I finally replace the code you give me because in the wpml/ languages the “flags” were already unchecked but the flags in the header were still appearing.
Here’s how it looks now:
http://independentclub.tv/
Thanks again
For Pagelines users, code for function.php need to go in PlatformBase and code for header needs to go in header.php in PlatformPro.
And is working, on the top of the page.
Big tnx for this!