function fwp_pager_handler() {
?>
<script>
(function($) {
$(document).on('facetwp-refresh', function() {
if (! FWP.loaded) {
$(document).on('click', '.pagination a', function(e) {
e.preventDefault();
var matches = jQuery(this).attr('href').match(//page/(d+)/);
if (null != matches) {
FWP.paged = parseInt(matches[1]);
}
FWP.soft_refresh = true;
FWP.refresh();
});
}
});
})(jQuery);
</script>
<?php
}
add_action( 'wp_footer', 'fwp_pager_handler', 100 );