Print

JCI and WPML

The WPML-Plugin gives a good way to have a multilanguage WordPress-Website. It offers several ways to do this.

On the other hand APIs can provide data and content in different languages. Some need a …?lang=en in the API-URL, some other info in headers.

JCI and WPML can work together in this way:

Licencing

If you set up a multisite-Wordpress and one network-site is DOMAIN/de and another network-site is DOMAIN/de you normally need two JCI-licences. But if WPML is in use you only need one JCI-licence.

Asking the API

Depending on the language you want to ask the API. For that you need to know what language a page has. WPML “knows” that, and then JCI too.

The twig-function wp_get_page_properties gives us all info about a page.
You can use the in the twig-content-template and the http-request (URL & header).

A example code snippet:

{# get all page properties #}
{% set pprop = wp_get_page_properties() %}
{# in case wpml is active #}
wpml: {{pprop.wpml.lang}}<br>
{% if pprop.wpml.lang=="de" %}
DE
{% else %}
EN
{% endif %}
Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
Previous JCI and Elementor
On this page: