Created
November 12, 2020 16:15
-
-
Save mgibbs189/017391bb6657e7566eea26215385a77e to your computer and use it in GitHub Desktop.
Automatically expand all top-level terms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add to your (child) theme's functions.php file | |
add_action( 'wp_head', function() { | |
?> | |
<script> | |
(function($) { | |
$(document).on('facetwp-loaded', function() { | |
$('.facetwp-facet-product_categories > .facetwp-checkbox .facetwp-expand').each(function() { | |
if ('[+]' == $(this).text()) { | |
$(this).click(); | |
} | |
}); | |
}); | |
})(jQuery); | |
</script> | |
<?php | |
}, 100 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment