<?php
/** captures pagination for use with facet
** pager must be within facetwp-template class
** change 'a.page-numbers' to match element of the links ln 12
** ln 14 matches on page link format of /page/x/, change if needed
**/
add_action( 'facetwp_scripts', function() {
?>
<script>
(function($) {
$().on('click', 'a.page-numbers', function(e) {
e.preventDefault();
var matches = $(this).attr('href').match(/\/page\/(\d+)/);
if (null !== matches) {
FWP.paged = parseInt(matches[1]);
FWP.soft_refresh = true;
FWP.refresh();
}
});
})(fUtil);
</script>
<?php
}, 100 );