July 7, 2023 at 2:49 PM
#194174
Participant
In other words according to my previous post – I have changed the code as you have advised me and it did not solve my issue. New code:
function super_category_toggler() {
$taxonomies = apply_filters('super_category_toggler',array());
for($x=0;$x<count($taxonomies);$x++)
{
$taxonomies[$x] = '#'.$taxonomies[$x].'div .selectit input';
}
$selector = implode(',',$taxonomies);
if($selector == '') $selector = '.selectit input';
echo '
<script>
jQuery("'.$selector.'").change(function(){
var $chk = jQuery(this);
var ischecked = $chk.is(":checked");
$chk.parent().parent().siblings().children("label").children("input").each(function(){
var b = this.checked;
ischecked = ischecked || b;
})
checkParentNodes(ischecked, $chk);
});
function checkParentNodes(b, $obj)
{
$prt = findParentObj($obj);
if ($prt.length != 0)
{
$prt[0].checked = b;
checkParentNodes(b, $prt);
}
}
function findParentObj($obj)
{
return $obj.parent().parent().parent().prev().children("input");
}
</script>
';
}
add_action('admin_footer-post.php', 'super_category_toggler');
add_action('admin_footer-post-new.php', 'super_category_toggler');
do_action( 'mvx_add_product_form_end');
I’ve also tried following code, without success aswell:
do_action( 'mvx_add_product_form_end', 'super_category_toggler');
do_action( 'mvx_add_product_form_end.php', 'super_category_toggler');
add_action( 'mvx_add_product_form_end', 'super_category_toggler');
add_action( 'mvx_add_product_form_end.php', 'super_category_toggler');






