If you are having a notice about writing the .mo files please read this doc

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This thread is resolved. Here is a description of the problem and solution.

This topic contains 7 replies, has 2 voices.

Last updated by gingerT 4 years, 3 months ago.

Assigned support staff: abdallah.d.

Author Posts
August 10, 2015 at 6:40 pm #676705

gingerT

I am trying to:

Show the opposite language in my menu.

I have English and French. When viewing English, I want the French language picker to show and vice versa.

I tried to add it to my function.php but not working

hidden link

August 11, 2015 at 1:05 pm #677233

abdallah.d
Supporter

Timezone: Asia/Beirut (GMT+02:00)

Hello,

Thanks for contacting WPML support 🙂

You would need to create a custom Language Switcher. Here's a link to our documentation for that: https://wpml.org/documentation/getting-started-guide/language-setup/custom-language-switcher/

Maybe you already did that? Would you like to post your code so we can check that for you?

Also, please add the debug information for your site. I just enabled that field for your next answer.

Thanks, Abdallah

August 11, 2015 at 2:14 pm #677302

gingerT

This is what I trued to follow - I added the code in the functions.php but it doesn't seem to do anything
https://wpml.org/forums/topic/display-opposite-language-in-menu-bar/
It is exactly the same thing I want to do

August 11, 2015 at 2:51 pm #677334

abdallah.d
Supporter

Timezone: Asia/Beirut (GMT+02:00)

Hi there,

I see you're using WPML-dev version. Did you try with the stable release?
Can you also test by switching back to the default theme, disable all non-WPML plugins and see if the problem is resolved?

If not, I need to request temporary access (wp-admin and FTP) to your site - preferably to a test site where the problem has been replicated if possible - in order to be of better help. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Best, Abdallah

August 12, 2015 at 7:00 am #677771

abdallah.d
Supporter

Timezone: Asia/Beirut (GMT+02:00)

Hi

I'm not able to login with the admin credentials you sent. Could you please double-check?

Thanks, Abdallah

August 12, 2015 at 1:13 pm #678069

abdallah.d
Supporter

Timezone: Asia/Beirut (GMT+02:00)

Hi.

I tried the case sensitive password 🙂
Still not able to login! I also asked someone from the team to try it and the password wasn't correct.

You can always revert to the stable version of WPML by downloading it from https://wpml.org/account/downloads/

I was able to login via FTP. Can you tell me where you pasted the code? I couldn't find it in the functions.php file.

Again, for the custom language switcher, please see: https://wpml.org/documentation/getting-started-guide/language-setup/custom-language-switcher/

Thanks, Abdallah

August 13, 2015 at 8:46 am #678638

abdallah.d
Supporter

Timezone: Asia/Beirut (GMT+02:00)

Hi again,

I was able to login. Thanks for confirming the URL 🙂

I saw the code in your functions.php, it was missing the right theme location. I changed that to 'main_navigation' to match the location of your menu. And I disabled the default language switcher in WPML > Languages

Here's the code I added:

add_filter('wp_nav_menu_items', 'new_nav_menu_items', 10, 2);
function new_nav_menu_items($items, $args) {
	if (function_exists('icl_get_languages') && $args->theme_location == 'main_navigation') {
		$languages = icl_get_languages('skip_missing=0');
    
		if(!empty($languages)){
			foreach($languages as $l){
				if(!$l['active']){
					$items = $items . '<li class="menu-item menu-item-language fusion-last-menu-item"><a href="' . $l['url'] . '">' . $l['native_name'] .'<span class="icl_lang_sel_bracket">(</span>' . $l['translated_name'] .'<span class="icl_lang_sel_bracket">)</span></a></li>';
				} 
			} 
		}
	}
	return $items;
}

Let us know if you need anything else

August 13, 2015 at 12:43 pm #678873

gingerT

This is perfect