• Apr
  • 19
  • 2012

When you are using WPML in wordpress at that time you might have come across the requirement for placing the flag icons of different languages.

You can show flags from WPML settings itself and also by writing a very small code wherever you wish to display the flags.

It will automatically show the flag icons of the different languages in which you have made your website.There is no need to do anything more than that. You just have to write the below code.

Code for displaying language flags for different languages :

function language_selector_flags(){
$languages = icl_get_languages('skip_missing=0&orderby=code');
if(!empty($languages)){
foreach($languages as $l){
if(!$l['active']) echo '<a href="'.$l['url'].'">';
echo '<img src="'.$l['country_flag_url'].'" alt="'.$l['language_code'].'" />';
if(!$l['active']) echo '</a>';
}
}
}

You can also place your html tags for having the look of flags as per your site’s look.

Isn’t it very simple???

Ravi Makhija

Ravi Makhija

A writer, an Entrepreneur. Curious about the internet of everything. Interested in the cutting edge landscape of mobile apps and SAAS products. Blogs for Guru Technolabs - A Mobile App Development Company.

Popular Blogs

Among the many digital tools that are being used with increasing frequency, the one that has the greatest...

Having a Best Website like opening a door and inviting…

In this internet era, the business website is the most…

The Live chat is the common thing now days, if…

Let's Discuss a Project

Please share your unique idea or project requirement with us, our business concern person will get back to you with further details.