FacetWP – support custom pagination

<?php

function fwp_custom_pager() {
?>
<script>
(function($) {
    $(document).on('click', '.pagination a', function(e) {
        if ('object' === typeof FWP) {
            e.preventDefault();
            var matches = $(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_head', 'fwp_custom_pager', 100 );