Aleš Sýkora wrote

Show Oxygen Element by current language with WPML

26. 4. 2021 in ,

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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

More from category
Aleš Sýkora wrote
How to use Animate On Scroll Library with Oxygen Builder
9. 8. 2021 in
Animate on scroll library (AOS) is easy to use CSS driven on scroll animation library. Plugin logic is in .JS, animations in .CSS. You can read more about AOS on CSS tricks and of course on AOS on GitHub. UPDATE: I found this is already included in oxygen LOL :-D. You need to go to […]
Read More
Aleš Sýkora wrote
WooCommerce category clustered by child taxonomies in WordPress
6. 2. 2021 in
If you need to display your parent product category sorted by child taxonomies in clusters – for each child taxonomy it owns row – for example: Breakfasts Category Archive – Parent category Vegetarian – child category Product 1 Product 2 Vegan – child category Product 1 Product 2 Meat lovers – child category Product 1 […]
Read More
Aleš Sýkora wrote
Remove Archive Title prefix in WordPress
28. 5. 2021 in
Put this code in code snippets plugin.
Read More
magnifiercross linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram