Created
October 25, 2019 19:12
-
-
Save djrmom/bbda4873be2faab7f68a0b182b0b81ed to your computer and use it in GitHub Desktop.
facetwp add reset button to flyout
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 | |
/** 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 | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment