How to add language in visibility condition?

hey guys, everything is in the title : how can we add polylang current language in the visibility conditions ?

i’ve found a snippet to add this to Oxygen, so i guess we can do it for cwicly too.

Here is the snippet for oxy:

if( function_exists(‘oxygen_vsb_register_condition’) && function_exists(‘pll_languages_list’) ) {

$lang_list = pll_languages_list();

oxygen_vsb_register_condition(
	
	//Condition Name
	'Locale',
	
	//Values
	array( 
		'options' => $lang_list,
		'custom' => false
	),
	//Operators
	array('==', '!='),
	
	//Callback Function
	'polylang_callback',
	
	//Condition Category
	'Polylang'
);

function polylang_callback($value, $operator) {
	
	$my_lang = pll_current_language();
	global $OxygenConditions;
	return $OxygenConditions->eval_string($my_lang, $value, $operator);
	
}

}

i can see what i have to change in this snippet but i don’t know what to put instead of the oxy parts, can someone help with this ?
@Louis @Marius @StrangeTech ?

Hello @pomilo,

Custom visibility conditions are being worked on right now with the rework of conditions as a whole.

Unfortunately, we don’t currently support them at this time, but you should be able to use the Function return condition in the Visibility Conditions to achieve the desired effect.

1 Like

thanks. I’ve built a bunch of templates, and used visibility conditions for header and footer, it was a time saver