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 topic contains 7 replies, has 2 voices.

Last updated by gabrielaC-4 11 months, 4 weeks ago.

Assigned support staff: Bruno.

Author Posts
October 20, 2018 at 1:21 am

gabrielaC-4

I am trying to: The default language is spanish, and I need the main menu in spanish be the same main menu translated in english, but the "Home" link in english main menu shows always in second place.
I think maybe this is the problem of both menus don't work when I try to change some page from one language to other, because always the link goes to home page and not to synch page.

Link to a page where the issue can be seen: In hidden link, You can see the home page in spanish with the first link in main menu called "Inicio" (the main menu is hidden in hamburger menu). "Inicio" is "Home" in English. But if you change the language to English, the "Home" link is in second place after "Firm". I have tried to change its place in "Appearance > Menu" but the system does not save the changes.
And If I'm in whetever page, like "Firma" in spanish for example, and I try to change the language to english, the system go to english "Home" page and no to "Firm" page in english.
I think these two errors are related, but I do not know where else to look.

I expected to see:
I want to see both main menu links in same order. In english main menu I need "Home" in first place. And I want to go to the same translated page when I change the language and don't go to home page.

Instead, I got: The translation is difficult and the menus are not synchronized.

October 22, 2018 at 3:51 pm #2838779

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Thank you for contacting us. Please, my sincere apologies for the delay in answering.

When I try to access your site, it looks like the credentials are incorrect: ERROR: La contraseña que has introducido para el usuario gcordero es incorrecta. ¿Olvidaste tu contraseña?

Also, when I access both languages, no menu is displayed in the header of your site. I'll attach an image for you to see.

Should I follow some other step to see the problem? Your next message will be private so you can check the credentials.

Thank you.

October 22, 2018 at 4:11 pm
October 24, 2018 at 1:05 am #2844264

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi,

Thank you. About the "Home" menu, I have fixed this by going to the Appearance > Menus page and switching to the secondary language.

On the link does not point to the correct page, this seems to be happening by the way the language selector was added.

From what I've noticed you're inserted this as a JavaScript with static code (Divi > Theme Options > Integration) and so it's not working as expected.

Is there any reason you are entering this static code?

Thank you.

October 24, 2018 at 1:30 am #2844269

gabrielaC-4

Yes, the Divi theme support helped me because Divi showed the flags in the hidden hamburger menu and I needed to show them in front, always visible.
The js code is in <head> and is:

<script>
jQuery(function($){
$('.mobile_menu_bar')
.after('<li class="menu-item wpml-ls-slot-15 wpml-ls-item wpml-ls-item-es wpml-ls-current-language wpml-ls-menu-item wpml-ls-first-item menu-item-type-wpml_ls_menu_item menu-item-object-wpml_ls_menu_item menu-item-wpml-ls-15-es"><a title="Español" href="hidden link"><img class="wpml-ls-flag" src="hidden link" alt="es" title="Español"><span class="wpml-ls-native">Español</span></a>')
.after('<li class="menu-item wpml-ls-slot-15 wpml-ls-item wpml-ls-item-en wpml-ls-menu-item wpml-ls-last-item menu-item-type-wpml_ls_menu_item menu-item-object-wpml_ls_menu_item menu-item-wpml-ls-15-en"><a title="English" href="hidden link"><img class="wpml-ls-flag" src="hidden link" alt="en" title="English"><span class="wpml-ls-native">English</span></a>')
});
</script>

<script type="text/javascript">
jQuery( document ).ready(function() {
jQuery('span.mobile_menu_bar.et_pb_header_toggle.et_toggle_slide_menu').insertAfter('.menu-item-wpml-ls-15-es');
});
</script>

Also I had to add some css:
.mobile_menu_bar,li.wpml-ls-slot-15 {
   float: left !important;
}
.logo_container{
  width:80% !important;
}
.wpml-ls-menu-item .wpml-ls-flag+span {
display: none;
margin-left: .4em;
font-family: 'Raleway',Helvetica,Arial,Lucida,sans-serif;
font-weight: 400;
text-transform: uppercase;
font-size: 0.8rem;
color: #1a1f26;
}

At the beginning the module of the flags worked well and I could go from one place to another without problems.

About the menu items, you say english menu was not selected in english language? thank you if it was like that, it was then a thing too simple! :S

October 25, 2018 at 9:15 am #2849218

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

So in case this code is creating a static language selector. For this reason this is not working as expected. You can see in the markings below:

<script>
jQuery(function($){
$('.mobile_menu_bar')
.after('<li class="menu-item wpml-ls-slot-15 wpml-ls-item wpml-ls-item-es wpml-ls-current-language wpml-ls-menu-item wpml-ls-first-item menu-item-type-wpml_ls_menu_item menu-item-object-wpml_ls_menu_item menu-item-wpml-ls-15-es"><a title="Español" href="hidden link"><img class="wpml-ls-flag" src="hidden link" alt="es" title="Español"><span class="wpml-ls-native">Español</span></a>')
.after('<li class="menu-item wpml-ls-slot-15 wpml-ls-item wpml-ls-item-en wpml-ls-menu-item wpml-ls-last-item menu-item-type-wpml_ls_menu_item menu-item-object-wpml_ls_menu_item menu-item-wpml-ls-15-en"><a title="English" href="hidden link"><img class="wpml-ls-flag" src="hidden link" alt="en" title="English"><span class="wpml-ls-native">English</span></a>')
});
</script>

Note in the above highlights that the link is fixed and this does not change when you are on one page and switch to another page.

To fix the selector, I made some minor changes to the code: https://pastebin.com/R7V3V6pW

For the home menu, yes, it was just necessary to sort it out again.

Please, let me know if I can help with any other questions you may have. I'll be happy to help.

Thank you.

October 25, 2018 at 12:18 pm #2849707

gabrielaC-4

Thank you very much! now it works! But still don't work in mobil, I would not know how to fix it, especially when it comes to jQuery, I hope you can help me.
Thanks again.

October 25, 2018 at 12:33 pm #2849748

Bruno
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Glad to hear that it now works. Are you talking about the click that is not working to switch to English par? If yes, I fixed it also using the CSS below:

#et-top-navigation, .wpml-ls-item { position: relative; z-index: 9999; }

Please, could you check if this is working as expected?

Thank you.

October 25, 2018 at 1:49 pm #2849982

gabrielaC-4

My issue is resolved now. Thank you!