facetwp flyout html filter

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php
/** prepends 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 = `
<h2>title before filters</h2>
`;
return flyout_html.replace(‘{content}’, html + ‘{content}’);
});
});
})(jQuery);
</script>
<?php
} );
{{/gist}}