Skip Navigation

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

Last updated by tautvydasV 2 years, 7 months ago.

Assisted by: Mihai Apetrei.

Author Posts
September 8, 2021 at 12:22 pm #9547865

tautvydasV

I am trying to: change the menu flag position in mobile view from bottom to top.

September 9, 2021 at 5:53 pm #9558249

Mihai Apetrei
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hi there.

This would need some custom coding, as you can see in the example here:
https://wpml.org/forums/topic/flag-in-wrong-area/#post-2609196

For your situation, we need to change a class in the code first and here's the complete code:

jQuery(document).ready(function(e) {
    jQuery('.wpml-ls-item').each(function(index, element) {
        jQuery(this).parent(".et_mobile_menu").prepend(this);
    });
});

I see that you are using Divi so you can follow the steps in Point 2 here (hidden link) to see how you can add this code that I shared with you above in the Divi Theme Options.

You can also find other articles in the custom search URL that I created for you below to see other ways that you can use to add custom jQuery code to your Divi theme.

- hidden link..69i57j0i22i30l3.4358j0j7&sourceid=chrome&ie=UTF-8

Kind regards,
Mihai Apetrei

September 9, 2021 at 6:38 pm #9558441

tautvydasV

Doesn't work.Paste the code in the divi theme options integrations tab .

Capture.PNG
September 10, 2021 at 9:44 pm #9565977

Mihai Apetrei
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hi there.

Is probably not working because you did not add the code that I sent you above, instead, you added the code found here (https://wpml.org/forums/topic/flag-in-wrong-area/#post-2609196).

You need to add the exact code that I customized for you (see how I switched ".m-menu" with ".et_mobile_menu"?)

This is the correct code:


jQuery(document).ready(function(e) {
    jQuery('.wpml-ls-item').each(function(index, element) {
        jQuery(this).parent(".et_mobile_menu").prepend(this);
    });
});

That should do exactly what you wanted 🙂

Mihai

September 11, 2021 at 2:39 pm #9568725

tautvydasV

You doesn't understant. I want to see on desktop version see last (item) flag position, but on mobile menu version on top (first item).

September 13, 2021 at 11:16 pm #9579557

Mihai Apetrei
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hi there.

The code that I gave you does exactly what you asked:

1. It will keep the language switcher as it is now, at the end of the menu (after AKCIJA)
2. It will add the language switcher flags at the very top of the menu ONLY WHEN ON MOBILE.

Isn't that what you requested?

Please let me know.

Mihai

September 14, 2021 at 6:49 am #9580901

tautvydasV

Yes, but this code doesn't work for me(photo). Could I sent you website login?

Capture2.PNG
September 14, 2021 at 11:19 pm #9587593

Mihai Apetrei
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Welcome back and thank you for your response!

I tested this code on your website straight in the Javascript Browser Console and it worked so the code should work perfectly.

What it doesn't work though is probably the way the code is added on the website which I think should be something that the Divi support team should be able to help with.

This is custom coding work and we usually don't offer pieces of the code, especially if they are super complex.

In our case, this was not very complex but we can only help with the code that is needed.

The implementation of the code (and any complex coding) is out of the purpose of our Support Policy so my recommendation is to get in touch with Divi Support (hidden link) and just let them know what you want to accomplish, also let them know that the code was tested in the browser javascript console and it works correctly but you need help to properly implement it into your website through the theme options as you found in the documentation URLs that I shared with you which are public on the internet and even they can see those.

Please let me know how that goes.

I will be waiting for your response.

Mihai

September 15, 2021 at 2:58 pm #9593919

tautvydasV

Thank you. I fix it.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.