Last active
March 6, 2018 12:41
-
-
Save mgibbs189/96de22445986a80bea65fc52eb533858 to your computer and use it in GitHub Desktop.
FacetWP - support custom pagination
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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