Show Oxygen Element by current language with WPML_CURRENT_LANGUAGE

Author: Aleš Sýkora, 26. 4. 2021

When you use WPML with Oxygen Builder and use 1 template for all languages, then you propably want to display/hide elements conditionally. And of course you can. Use the WPML's filter wpml_current_language to get current language code. Then use the if function to return value you want.

I am returning the language code and then using it in Oxygen builder.

function toolwiki_get_lang() {
$current_language_code = apply_filters( 'wpml_current_language', NULL );
if ($current_language_code == 'cs') {
	return 'cs';
} elseif ($current_language_code == 'en') {
	return 'en';
} elseif ($current_language_code == 'de') {
	return 'de';
Conditionally displayed counters
PHP function return value options in Oxygen
WPML current language conditional function in Oxygen