Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
WPML custom language switcher
* WPML language switcher customizations: htp://
function custom_wpml_lang_switcher() {
if (function_exists('icl_get_languages')){
// remove WPML default css
// Custom language layout selector ?>
<div class="languages">
$languages = icl_get_languages('skip_missing=N&orderby=KEY&order=DIR&link_empty_to=str');
foreach($languages as $language){
//$flag = $language['country_flag_url'];
$url = $language['url'];
$isActive = $language['active'];
$name = $language['native_name']
<a class="<?php if($isActive == 1){ ?> class="active" <?php } ?>" href="<?php echo $url; ?>">
<?php echo $name; ?>
<?php } ?>
<?php }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.