This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: A question and possibly a bug

#31825
Ernest MarcinkoErnest Marcinko
Keymaster

Thank you very much for the details!

I’m afraid I can’t access the site, it requires a .htaccess login. I’m not sure if there is a way to prevent this behavior either, because it is handled programmatically within a function. If I was to recommend a custom code to not check the checkboxes, then it would also prevent opening the parent/child structures, as it is handled at the same time.

You could try maybe this custom code:

add_action('wp_footer', 'asp_api_sample_code');
function asp_api_sample_code() {
	?>
	<script>
	jQuery(function ($) {
		var settingsCheckboxToggle = function ($node) {
			var $parent = $node;
			var $checkbox = $node.find('input[type="checkbox"]');
			var lvl = parseInt($node.data("lvl")) + 1;
			var i = 0;
			while (true) {
				$parent = $parent.next();
				if ($parent.length > 0 &&
					typeof $parent.data("lvl") != "undefined" &&
					parseInt($parent.data("lvl")) >= lvl
				) {
					if ($checkbox.prop("checked")) {
						$parent.removeClass("hiddend");
					} else {
						$parent.addClass("hiddend");
					}
				} else
					break;
				i++;
				if (i > 400) break; // safety first
			}
		}
		$('.asp_option_cat input[type="checkbox"]').off('asp_chbx_change');
		$('.asp_option_cat input[type="checkbox"]').on('asp_chbx_change', function (e) {
			settingsCheckboxToggle($(this).closest('.asp_option_cat'));
			var id = $(this).closest('.asp_w').data('id');
			var instance = $(this).closest('.asp_w').data('instance');
			ASP.api(id, instance, 'searchFor');
		});
	});
	</script>
	<?php
}

It is a replication of the original, but I removd the part where the checkboxes are manipulated. Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!