Tagged: wpml language selector
-
AuthorPosts
-
March 3, 2016 at 6:01 pm #592748
Hi,
I recently updated the theme and all plugins (incl w-pml) to the newest versions and now the w-pml dropdown menu selector is gone.
I can only get horizontal flags or flags+name.Before the update the dropdown menu was working fine and since I’m using a child-theme I believe there had been some slight modification to a core theme php file. The difficulty is that i can not find out what the modification was. I can’t find the thread that this was mentioned in any more.
In my functions.php I already had the modification to remove the Enfold-theme flags:add_action('after_setup_theme','avia_remove_main_menu_flags'); function avia_remove_main_menu_flags(){ remove_filter( 'wp_nav_menu_items', 'avia_append_lang_flags', 20, 2 ); remove_filter( 'avf_fallback_menu_items', 'avia_append_lang_flags', 20, 2 ); } //// function WPML_add_menu_item( $items, $args ) { $theme_locations = array( 'primary', 'secondary', 'footer-menu', 'sidebar-menu' ); if( !empty( $args->theme_location ) && in_array( $args->theme_location, $theme_locations ) ) { ob_start(); ?> <li class="menu-item ls-menu"><?php echo do_action('icl_language_selector'); ?></li> <?php $items .= ob_get_contents(); ob_end_clean(); } return $items; } // Add ability to add wpml language switcher to more than one menu 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 ) { 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)) { foreach($languages as $lang) { $currentlang = (ICL_LANGUAGE_CODE == $lang['language_code']) ? 'avia_current_lang' : ''; if(is_home() || is_front_page()) $lang['url'] = $sitepress->language_url($lang['language_code']); $items .= "<li class='av-language-switch-item language_".$lang['language_code']." $currentlang'><a href='".$lang['url']."'>"; $items .= " <span class='language_flag'><img title='".$lang['native_name']."' src='".$lang['country_flag_url']."' /></span>"; $items .= "</a></li>"; } } return $items; } }
Perhaps you have any idea to get the results back that I had previously?
This is what I had and want:
https://www.dropbox.com/s/kc4gbconmrlqpd4/3-3-2016%203-48-23%20PM.jpg?dl=0This is what I have after the update:
https://www.dropbox.com/s/574jj3tq9eps1w5/3-3-2016%203-52-56%20PM.jpg?dl=0Thank you!
- This topic was modified 8 years, 8 months ago by rcdillon.
March 6, 2016 at 9:36 pm #594003Never mind.
It’s already working, don’t know why it wasn’t working..March 9, 2016 at 10:27 am #595436 -
AuthorPosts
- You must be logged in to reply to this topic.