Wordpress - Multi-lang WPML


Outlast Framework support multiple languages in its WordPress plugin using WPML.

Setting up multiple languages

To set up multiple languages for your site, you first need to:

  1. Enable the WPML plugin
  2. Select the default language for the current content
  3. Select all the alternate languages you wish to add
  4. Don’t forget to also add all supported locales to site/index.php
  5. Add a language selection logic to your default controller’s __load() method

Then for each language you need to:

  1. Add the locale to WPML and to site/index.php
  2. Select the language at the top of the WordPress admin interface (using the flags)
  3. Create a home page
  4. Set the template of the home page
  5. Localize the menu
  6. Set up the page in Settings / Reading / Front page displays feature to select the home page

Mapping languages to URLs

Two modes of language switching is supported in OFW’s WordPress plugin. You can choose to use a http://customdomain.hu for each language or you can set up WPML to display languages by query string such as http://mydomain.hu?lang=en.

Language selection by query string is not currently supported by OFW.

To set this up, choose the proper option in WPML / Languages / Language URL format.

Setting the WPML language

WPML language is set automatically when you use the $this->zajlib->lang->set() method. Refer to the documentation on setting and getting the current locale.

Outlast Web & Mobile Development (c) 2023 | Privacy Policy |