Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 4 replies, has 2 voices.

Last updated by Eduard 6 years, 1 month ago.

Assigned support staff: Eduard.

Author Posts
November 26, 2015 at 3:37 pm #755827


I am trying to: Set the custom switcher - HTML version instead the flags

URL of (my) website where problem appears:

I expected to see: Only language code ("EN" "HR" "DE" "FR") displayed the same as it is displayed now with flags

Instead, I got:

November 27, 2015 at 11:06 am #756463



If the native language names are not used in the site you can achieve what you want by changing the native language names and configuring the language switcher accordingly.

For changing language names follow these steps:
1. Please create a full database backup.
2. WPML->Languages->Site Languages
3. Click on 'Edit Languages'
4. You will see the list of all active languages, with their translations.
Update translation text with language codes for all active languages.
5. Save your changes.

To configure language switcher follow these steps:
1. WPML->Languages->Language switcher options
2. From "Language switcher style" choose "List of languages" and select "Horizontal" from drop-down menu
3. From "What to include in the language switcher" select "Native language name" and make sure to deselect other options.
4. Save your changes.

If this is not an option you can use this example code:
hidden link

Please let us know if you will have any issue.

Thank you.

November 27, 2015 at 11:56 am #756526


Hi Eduard,
I folowed all the steps but I still see the flags and not the country code (as I would like it to see).

I had the similar problem in issue -
In this thread I have posted the backend login data so you can check it on the backend. Could you please pinpoint the problem.

best regards,

November 27, 2015 at 12:38 pm #756569



I’ve checked your site and the configuration is correct.
The reason why changes made to language switcher are not showing up is that your theme is using custom language switcher, which ignores WPML language switcher configuration.

I’ll continue to work on this ticket to find the best solution and will update you at earliest.

Thank you.

November 30, 2015 at 1:35 pm #757924



To archive the functionality you have described, you need to create a child theme and replace the custom switcher.
For that please follow these steps:

Please create a full database and file backup, before making changes.

1. In your wp-content/themes folder create folder for child theme like "inspiry-medicalpress-child"
2. Place file called "style.css" under wp-content/themes/inspiry-medicalpress-child/
3. Add this to wp-content/themes/inspiry-medicalpress-child/style.css

 Theme Name:   MedicalPress Child Theme
 Template:     inspiry-medicalpress

4. Copy header.php file from wp-content/themes/inspiry-medicalpress to wp-content/themes/inspiry-medicalpress-child
5. Open header.php find custom language switcher code around line 62

   $languages = icl_get_languages('skip_missing=0&orderby=code');
     echo '<div id="inspiry_language_list"><ul class="clearfix">';
     foreach($languages as $l){
        echo '<li>';
           if(!$l['active']) echo '<a href="'.$l['url'].'" title="'.$l['translated_name'].'">';
              echo '<img src="'.$l['country_flag_url'].'" height="12" alt="'.$l['translated_name'].'" width="18" />';
              if(!$l['active']) echo '</a>';
        echo '</li>';
     echo '</ul></div>';

and replace with

echo '<div id="inspiry_language_list">';
echo '</div>';

6. Go to WPML-> Languages->Language switcher options
7. Select "Language switcher style" to be "Horizontal"
8. From "What to include in the language switcher" select "Native language name" only
9. In "Additional CSS (optional)" put the following styles

#lang_sel_list {
         position: inherit;
#lang_sel_list ul {
         border: none;
#inspiry_language_list #lang_sel_list ul {
        margin-top: 7px !important;
#lang_sel_list ul:before,
#lang_sel_list ul:after {
	content: "";
	display: table;
#lang_sel_list ul:after {
	clear: both;

10. Save your changes
11. Go to WPML->Languages->Site Languages
12. Click on 'Edit Languages'
13. You will see the list of all active languages, with their translations.
Update translation text with language codes for all active languages.
14. Save your changes.
15 Go to Appearence->Themes and activate your child theme which will be called "MedicalPress Child Theme"