Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
// Filter wp_nav_menu() to add additional links and other output
function new_nav_menu_items($items,$args) {
if (function_exists('icl_get_languages')) {
$languages = icl_get_languages('skip_missing=0');
if(1 < count($languages)){
foreach($languages as $l){
$items = $items.'<li class="menu-item"><a href="'.$l['url'].'"><img src="'.$l['country_flag_url'].'" height="12" alt="'.$l['language_code'].'" width="18" /> </a></li>';
return $items;
add_filter( 'wp_nav_menu_items', 'new_nav_menu_items',10,2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment