Skip to content

Instantly share code, notes, and snippets.

@hkirsman
Created June 26, 2012 19:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hkirsman/2998474 to your computer and use it in GitHub Desktop.
Save hkirsman/2998474 to your computer and use it in GitHub Desktop.
Wordpress WPML custom
<?php
function languages_list_custom() {
$languages = icl_get_languages('orderby=code');
$languages_count = count($languages);
if(!empty($languages) && $languages_count>1){
echo '<div id="lang_sel_list_custom"><ul>';
$i=1;
global $sitepress_settings;
$show_flags = $sitepress_settings['icl_lso_flags'];
foreach($languages as $l) {
echo '<li' . ($l['active'] ? ' class="active"' : '') . '>';
if($l['country_flag_url'] && $show_flags){
if(!$l['active']) echo '<a href="'.$l['url'].'">';
echo '<img src="'.$l['country_flag_url'].'" height="12" alt="'.$l['language_code'].'" width="18" />';
if(!$l['active']) echo '</a>';
}
if(!$l['active']) echo '<a href="'.$l['url'].'">';
//echo icl_disp_language($l['native_name'], $l['translated_name']);
echo icl_disp_language($l['native_name'], false);
if(!$l['active']) echo '</a>';
echo '</li>';
if ($languages_count!=$i) {
echo '<li class="spacer">|</li>';
}
$i++;
}
echo '</ul></div>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment