Please make sure to update to WPML 4.3.4 before reporting any issue

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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 3 years, 11 months ago.

Assigned support staff: Eduard.

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

zvonimirF

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

URL of (my) website where problem appears: new.videntis.hr

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

Eduard

Hi,

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

zvonimirF

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 - https://wpml.org/forums/topic/switcher-order/
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,
zvonimikr

November 27, 2015 at 12:38 pm #756569

Eduard

Hi,

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

Eduard

Hi,

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

if(function_exists('icl_get_languages')){
   $languages = icl_get_languages('skip_missing=0&orderby=code');
   if(!empty($languages)){
     echo '<div id="inspiry_language_list"><ul class="clearfix">';
     foreach($languages as $l){
        echo '<li>';
        if($l['country_flag_url']){
           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">';
    do_action('wpml_add_language_selector');
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"

Thanks.