• Apr
  • 19
  • 2012
blog-image

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

recent-blog-image

Among the many digital tools that are being used with…

recent-blog-image

This question is most searched question in google. It is…

recent-blog-image

When you are using WPML in wordpress at that time…

recent-blog-image

Method for linking pages that aren't in a Site Menu…

recent-blog-image

Manier times we come across requirement like fetching/getting content from…

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.