Created
June 26, 2012 19:55
-
-
Save hkirsman/2998474 to your computer and use it in GitHub Desktop.
Wordpress WPML custom
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
<?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