-
AuthorPosts
-
September 5, 2014 at 5:10 pm #314123
Hi,
I have unchecked the flag option in the WPML settings as I only need a text version of the language selector.
However I still only see the flags. Any help would be really appreciated.
http://www.toticorp.com
Thanks
ESeptember 5, 2014 at 5:27 pm #314130I tried this solution but then everything is hidden. even the flags:
https://kriesi.at/support/topic/display-language-switcher-in-wpml-and-enfold/Any help is appreciated
Thanks
E.September 5, 2014 at 6:45 pm #314157ok some more info as I have updated the flags to display “text” (French, English) instead of actual flags. But that’s not the solution I would like to keep as it looks really bad on retina display and I would really like this to be actual HTML text.
Thanks again
E.September 5, 2014 at 9:39 pm #314208Hi!
You can add this code to the child theme functions.php file:
if(!function_exists('avia_append_lang_flags')) { //first append search item to main menu add_filter( 'wp_nav_menu_items', 'avia_append_lang_flags', 20, 2 ); add_filter( 'avf_fallback_menu_items', 'avia_append_lang_flags', 20, 2 ); function avia_append_lang_flags( $items, $args ) { if ((is_object($args) && $args->theme_location == 'avia')) { global $avia_config, $sitepress; if(empty($avia_config['wpml_language_menu_position'])) $avia_config['wpml_language_menu_position'] = apply_filters('avf_wpml_language_switcher_position', 'main_menu'); if($avia_config['wpml_language_menu_position'] != 'main_menu') return $items; $languages = icl_get_languages('skip_missing=0&orderby=custom'); if(is_array($languages)) { $num_el = $total_el = count($languages); foreach($languages as $lang) { $num_el--; $currentlang = (ICL_LANGUAGE_CODE == $lang['language_code']) ? 'avia_current_lang' : ''; if(is_home() || is_front_page()) $lang['url'] = $sitepress->language_url($lang['language_code']); $style = ($num_el != $total_el) ? ' padding-left:5px;' : ''; $items .= "<li class='language_".$lang['language_code']." $currentlang'><a style='padding-right:0;{$style}' href='".$lang['url']."'>"; $items .= " <span class='language_flag'>".strtoupper($lang['language_code'])."</span>"; if($num_el > 0) $items .= " | "; $items .= "</a></li>"; } } } return $items; } }
It will replace the default language switcher which uses images (flags) with text based links. Original thread: https://kriesi.at/support/topic/wmpl-country-code-instead-of-flags/
Regards,
PeterJanuary 30, 2015 at 4:11 pm #388295Hi Dude thanks so much. It’s showing it in text format now, however is it possible to spell out the language name instead of the abbreviation?
Like so: Français | EnglishLink to home page of staging site: http://b85.a2f.myftpupload.com/
Thanks so much for all your help
EdnaFebruary 1, 2015 at 6:07 am #388936Hi!
Try adding this on Quick CSS:
.avia_wpml_language_switch li .language_code { display: none; } span.language_translated { display: block !important; }
Regards,
IsmaelFebruary 2, 2015 at 4:11 pm #389378Thanks Ismael,
It worked wonderfully.This is the block of css I use now:
/* Remove language flags and replace with language name */ .avia_wpml_language_switch li .language_flag img { display: none; } .avia_wpml_language_switch li .language_code { display: none !important; } .avia_wpml_language_switch li .language_translated {display: block !important; font-size: 14px;}
-
AuthorPosts
- The topic ‘WPML language selector in main menu’ is closed to new replies.