luffy99
Forum Replies Created
-
After adding this JS it’s completely working like old one. @sabbirislam397 you can try
function _kirki_active_callback_fix() {
$js = <<<'JS'
(function() {
if ( typeof wp === 'undefined' || ! wp.customize ) return;
wp.customize.bind( 'ready', function() {
if ( typeof window.kirkiControlDependencies === 'undefined' ) return;
function evaluate( expected, actual, operator ) {
if ( operator === '===' ) return expected === actual;
if ( operator === '==' || operator === '=' ) return expected == actual;
if ( operator === '!==' ) return expected !== actual;
if ( operator === '!=' ) return expected != actual;
if ( operator === '>' ) return actual > expected;
if ( operator === '>=' ) return actual >= expected;
if ( operator === '<' ) return actual < expected;
if ( operator === '<=' ) return actual <= expected;
return expected == actual;
}
function checkConditions( conditions ) {
for ( var i = 0; i < conditions.length; i++ ) {
var c = conditions[ i ];
var setting = wp.customize( c.setting );
if ( ! setting ) continue;
if ( ! evaluate( c.value, setting.get(), c.operator ) ) return false;
}
return true;
}
jQuery.each( window.kirkiControlDependencies, function( controlId, conditions ) {
wp.customize.control( controlId, function( control ) {
var check = function() {
return checkConditions( conditions );
};
control.active.validate = check;
jQuery.each( conditions, function( i, condition ) {
wp.customize( condition.setting, function( setting ) {
setting.bind( function() {
control.active.set( check() );
} );
} );
} );
control.active.set( check() );
} );
} );
} );
}());
JS;
wp_add_inline_script( 'kirki-customizer', $js );
}Thanks @wprashed for checking.
@sabbirislam397 He has already said that he tried this method, but it is not working.
@wprashed ‘active_callback’ works with PHP conditions, but as mentioned in your documentation, it does not change immediately. It will only work immediately with (KirKi) formats.
@wprashed Will you please look into this matter? It is very urgent. It has already been two months since the issue was raised.
@sabbirislam397 Since you have the same problem as me, is it working for you now after the update?
I have used ‘active_callback’ in many themes, but it is not working in any of them since update 5.2.
They released version 5.2.3, but the issue still exists 🙂
https://docs.themeum.com/kirki/arguments/active_callback/
‘active_callback’ => [ [
‘setting’ => ‘checkbox_demo’,
‘operator’ => ‘==’,
‘value’ => true,
] ],
- This reply was modified 3 weeks, 6 days ago by luffy99.
I’m also facing the same issue, but they haven’t released any update yet. Does that mean this plugin is deprecated?