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.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 15:00 7:00 – 15:00 7:00 – 15:00 7:00 – 15:00 7:00 – 15:00 -
- - - - - - -

Supporter timezone: Pacific/Easter (GMT-06:00)

This topic contains 3 replies, has 2 voices.

Last updated by Ilyes 10 months, 2 weeks ago.

Assisted by: Ilyes.

Author Posts
June 19, 2024 at 12:16 pm #15755557

marcosD-8

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?

June 19, 2024 at 8:25 pm #15758574

Ilyes
Supporter

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.

For example, it could be a button that will redirect you to the right sector, the URL should include the language code, and then you can translate that URL like this : https://wpml.org/faq/how-to-translate-urls-shortcodes-and-html-attributes-using-the-advanced-translation-editor/

Best,

June 20, 2024 at 9:22 am #15762420

marcosD-8

Hello Yves,

Thanks for getting back to us.

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.

Thanks.

June 20, 2024 at 7:34 pm #15766615

Ilyes
Supporter

Languages: English (English ) French (Français ) Arabic (العربية )

Timezone: Pacific/Easter (GMT-06:00)

Hello,

Yes, it is possible and there are multiple methods to do it, but not directly under WPML's option (we only provide you with a language switcher : https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/

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 :

https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/custom-language-switcher/
https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/adding-language-switchers-using-php-and-shortcodes/

I hope this made it clearer for you,

The topic ‘[Closed] Subdomains and multilingual WordPress Website’ is closed to new replies.