Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #209384

    Hello,
    I would like to have only the flags in my mainmenu, i have sellected the right option in the WPML admin options, but it always show the languages in a drop down list.
    I allready read this: https://kriesi.at/support/topic/problem-with-wpml-language-selector/ but it do not help me.
    I can’t give you my website URL because it’s under developpement and private but i can give you a simple acces if you want to see it ?

    I also read this: http://wpml.org/documentation/getting-started-guide/language-setup/custom-language-switcher/ but i would be forced to include some PHP/CSS/HTML code into you theme… :-(

    Thanks

    PS: please excuse my bad english, i’m not english…

    #209572

    Hey pako69!

    Please post login credentials here privately. Make sure to check “Set as private reply (Only you and moderators will see the content of this post)” above Submit button

    Regards,
    Yigit

    #209647
    This reply has been marked as private.
    #209913

    Hey!

    I added the flags to the main menu. I had to insert following code at the bottom of functions.php

    
    if(!function_exists('avia_append_lang_flags'))
    {
    	//first append search item to main menu
    	add_filter( 'wp_nav_menu_items', 'avia_append_lang_flags', 10, 2 );
    
    	function avia_append_lang_flags( $items, $args )
    	{	
    	    if ((is_object($args) && $args->theme_location == 'avia'))
    	    {
    	        global $avia_config;
    	        global $sitepress;
    			$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='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;
    	}
    }
    
    

    Cheers!
    Peter

    #209919

    hey :-) Thank you
    But as you can see, i have two language switcher: one append to the mainmenu and one near the phone number.
    I havn’t choose yet the one i want to keep, but can you explain me how to disable the one near the phont number?
    Thanks

    #209934

    Hey!

    You can disable it using this on Quick CSS:

    #header_meta .avia_wpml_language_switch {
    display: none;
    }

    Regards,
    Ismael

    #209936

    Hi!

    Yes, insert following code into the functions.php file

    
    add_action('init','avia_remove_default_lang_menu', 10);
    function avia_remove_default_lang_menu(){
    remove_action( 'avia_meta_header', 'avia_wpml_language_switch' );
    }
    

    Cheers!
    Peter

    #209944

    PHP… CSS … hum…
    Well, it do not matter: it works
    thanks

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Horizontal WPML Language switcher apend to the main menu’ is closed to new replies.