Skip to content

Instantly share code, notes, and snippets.

@mgibbs189
Last active March 6, 2018 12:41
Show Gist options
  • Save mgibbs189/96de22445986a80bea65fc52eb533858 to your computer and use it in GitHub Desktop.
Save mgibbs189/96de22445986a80bea65fc52eb533858 to your computer and use it in GitHub Desktop.
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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment