Created
March 28, 2016 11:50
-
-
Save davidperezgar/c507a0f6c273d8421242 to your computer and use it in GitHub Desktop.
Custom flags in WPML (functions.php)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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="'.get_bloginfo('stylesheet_directory').'/img/'.$l['code'].'.jpg" height="28" alt="'.$l['language_code'].'" width="28" />'; | |
if(!$l['active']) echo '</a>'; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment