facetwp add reset button to flyout

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php
/** appends your custom html before the facets output **/
add_action( ‘wp_head’, function() {
?>
<script>
(function($) {
$(function() {
if (‘object’ != typeof FWP) {
return;
}
FWP.hooks.addFilter(‘facetwp/flyout/flyout_html’, function( flyout_html ) {
var html = `
<button onclick=”FWP.reset()”>Reset</button>
`;
return flyout_html.replace(‘{content}’, ‘{content}’ + html );
});
});
})(jQuery);
</script>
<?php
} );
{{/gist}}