Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #209494

    Hi,

    The WPML language switcher options do not work with this theme, whichever changes i make in WPML are not reflected on the site. Either dropdown list or no flags etc.

    We are nearing completion of site and want to make it live this week but i cant make the necessary changes, can we get help with this issue ?

    thanks

    #209605

    Hey bluebirdnet!

    What type of header are you using? Do you use the social icons? You can manually add the language switcher by editing header.php, find this code on line 103:

    if(strpos($headerS,'bottom_nav_header') === false) avia_social_media_icons($social_args);

    Below, add this code:

    do_action('icl_language_selector');

    The switcher should be visible on the upper left corner of the header.

    Regards,
    Ismael

    #209635

    Hi Ismael,

    I am using the default theme, it has not been modified so using header included.

    Yes social icons are enabled.

    I have not changed anything, so perhaps you should check your theme again with WPML ?

    Thank you for the code, but isnt your theme loading the language switcher automatically? isnt the code already there ?

    #209915

    Hi!

    Normally Enfold will display the WPML flags in the top navigation menu. If you want to add the flags to the main menu add following code to the functions.php file (insert it at the very bottom of the 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', 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;
    	}
    }
    
    

    Best regards,
    Peter

    #210091

    Thanks for helping out Peter.

    I am ok with the language switcher in the top menu, that is best place. Actually i dont want any flags, just display FR | EN instead.

    My assumption is that the theme is placing that switcher there and overriding the WPML settings since it has no effect when i make changes.

    #210278

    Ismael,

    you received login info. could you please look into both our problems?

    thanks!

    Denny

    #210621

    Hey!

    Yes, you can overwrite the default theme function though – i.e. insert following code into the functions.php file

    
    	if(!function_exists('avia_wpml_language_switch'))
    	{
    		function avia_wpml_language_switch()
    		{
    			global $sitepress;
    			$languages = icl_get_languages('skip_missing=0&orderby=custom');
    			$output = "";
    
    			if(is_array($languages))
    			{
    				$output .= "<ul class='avia_wpml_language_switch'>";
    				$last_index = count($languages) - 1;
    				$counter = 0;
    
    				foreach($languages as $key => $lang)
    				{
    					$separator = ($counter < $last_index) ? ' | ' : '';
    					$currentlang = (ICL_LANGUAGE_CODE == $lang['language_code']) ? 'avia_current_lang' : '';
    
    					if(is_home() || is_front_page()) $lang['url'] = $sitepress->language_url($lang['language_code']);
    					         
    					$output .= "<li class='language_".$lang['language_code']." $currentlang'><a href='".$lang['url']."'>";
    					$output .= "	<span class='language_code'>".strtoupper($lang['language_code'])."</span>";
    					$output .= "</a>$separator</li>";
    
    					$counter++;
    				}
    
    				$output .= "</ul>";
    			}
    
    			echo $output;
    		}
    	}
    
    

    to overwrite the default language switcher code. Then use this css code

    
    .avia_wpml_language_switch li span.language_code{display: block !important;}
    

    to show the language shortcode instead of the flag.

    Best regards,
    Peter

    #210977

    Hi Peter,

    thanks for this code! ok i added the code at bottom of functions.php file but no change.

    where do i put the css code ?

    #211044

    Hey!

    Place it on Quick CSS or custom.css. It is important that you add the css code.

    Cheers!
    Ismael

    #211259

    Ismael / Peter

    still have the flags, no changes.

    tried to add the css code in custom.css maybe i am not putting it at the right place, can you show exactly how the file should look like with code.

    i really need to get rid of those flags.

    thanks
    Denny

    #211611

    Hi!

    Please add the code into the functions.php file and post a link to your website.

    Best regards,
    Peter

    #211857

    Peter,

    please show me how the css code should look like in the custom.css ?

    #212166

    Hey!

    This code should work: http://www.kriesi.at/support/topic/wpml-language-switcher-options-not-working/#post-210621 – if it doesn’t please post a link to your website.

    Best regards,
    Peter

Viewing 13 posts - 1 through 13 (of 13 total)

You must be logged in to reply to this topic.