Loading 0
Share

WPML Change order of menu languages in dropdown

WPML Change order of menu languages in dropdown

Hello.

With the following javascript code you can change position in languages. Something wpml doesn't support so far.

The example is for two languages but you can extend the code for more.

If you need help ask me.

var grlang = document.querySelectorAll("a[title='GR']")[0];
var grhref = grlang.attributes[1].value;
var enlang = document.querySelectorAll("a[title='EN']")[0];
var enhref = enlang.attributes[1].value;
grlang.attributes[0].value = 'EN'; //main language title
grlang.childNodes[0].innerText = 'EN'; //main language title
grlang.attributes[1].value = enhref; //main language redirect value
enlang.attributes[0].value = 'GR'; //second language title (after hover of dropdown)
enlang.childNodes[0].innerText = 'GR'; //second language title
enlang.attributes[1].value = grhref; //second language redirect value

Before you try the script, make sure that the name of the languages is correct by inspecting the source code of the element (right click in your browser and select inspect)

This post is also available in: Ελληνικά

Leave a Reply

Your email address will not be published. Required fields are marked *

01.

Here you can see all the services I provide

Registration and management of domain names (website address such as www.nicolaslagios.com)

Also management of dns records (e.g. connecting the domain to a specific server, fixing email spam problems, etc.)

Also ssl renewals etc

Installation and management of web & mail server in ubuntu vps with virtualmin, plesk, cpanel

Also studying and fixing server problems.

Necessary condition, the target server meets the conditions

At the moment for new wordpress websites you can choose from ready-made themes and we change the content (no custom changes). You can buy with a fixed price by clicking here!

My team and I undertake any data bridging implementation for Wordpress, Prestashop, Opencart, Joomla platforms.

We can connect data from any source, as long as the structure is stable and there is proper documentation and briefing.

We undertake the creation, regulation and enrichment of pages for social networks: Facebook, Linkedin, Instagram (profile), Twitter (profile), Tiktok (profile).

We also undertake the first boost of your pages for quick results in followers.

We undertake the repair and maintenance of your existing wordpress website.

For more information about the services, you can read the following and return here to schedule a meeting with me: https://maxservices.gr/en/internet-services/website-services-blank/additional-website-services/