Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function new_nav_menu_items($items,$args) {
- // uncomment this to find your theme's menu location
- //echo "args: <pre>"; print_r($args); echo "</pre>";
- if (function_exists('icl_get_languages') && $args->theme_location == 'CHANGE-LOCATION-HERE') {
- $languages = icl_get_languages('skip_missing=0');
- if(1 < count($languages)){
- foreach($languages as $l){
- if(!$l['active']){
- $items = $items.'<li class="menu-item"><a href="'.$l['url'].'">'.$l['native_name'].'</a></li>';
- }
- }
- }
- }
- return $items;
- }
- add_filter( 'wp_nav_menu_items', 'new_nav_menu_items',10,2 );
- //Ticket: https://wpml.org/forums/topic/language-switcher-shows-up-in-both-menus-and-unable-to-remove-it/#post-480238
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement