访问链接
WPML->Languages->Edit languages, they will always be resized to 18x12px. Please stick to the flags uploaded manually via FTP to the
上传文件到
wp-content/plugins/sitepress-multilingual-cms/res/flags 目录。
国旗图片下载
https://www.countryflags.com/en/united-states-flag-image.html
function language_selector_flags(){
if(function_exists('icl_get_languages'))
{
$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'].'" height="16" alt="'.$l['language_code'].'" width="24" />';
if(!$l['active']) echo '</a>';
}
}
}
}
参考
https://wpml.org/forums/topic/language-switcher-flags-only-2/