Background of the issue:
We are developing a multilingual WordPress website using WPML. We want to offer custom content based on the market sector and language spoken by the visitor. Visitors will choose their business sector (Auto, Pharma, IT) and language (English, French, Spanish) upon accessing the website. The content will be customized accordingly, e.g., auto.ourdomain.com/en for Auto sector in English. Visitors should be able to change the sector and language, and if they change the sector, the language should remain the same unless they choose a different language.
Symptoms:
We are unsure how to ensure the website remains in the selected language when a visitor changes the business sector.
Questions:
How can we ensure the website remains in the selected language when a visitor changes the business sector?
Is there a way to implement a sector and language selection mechanism that retains the language choice unless explicitly changed?
Languages: English (English )French (Français )Arabic (العربية )
Timezone: Pacific/Easter (GMT-06:00)
Hello,
Thank you for contacting WPML support team,
When creating the Sector switcher, are you able to manually assign the URL?
If so, it would be a simple solution to just write the full URL with the Language parameter in the URL, for example, the destination should be : auto.ourdomain.com/en on the English pages and auto.ourdomain.com/fr on the French pages.
We have not started yet. We are trying to find the best option before we start.
We tried to find some examples of websites that worked in that way (the conditional relationship Business Sector x Language) but could not find any. Everything we can find is always related to the languages only.
So we just wondered whether WPML will work the way we want or if we have to think of a different way to achieve what we would like to do.
This is entirely up to you and the developers working on the site (AKA a custom code)
What I mean by that is that you can customize the switcher however you want, and we can give you all the information you need related to languages to create it.
Again, the simplest method I could think of is to simply have a button or menu drop list switching to each sector where the destination URL has to point to the language too, e.g : auto.ourdomain.com/en on the English pages and auto.ourdomain.com/fr on the French pages.
Many other custom switcher could be developed depending on your developer's expertise, but here are some useful documentation on how to build custom language switcher :