FacetWP – convert hard-coded links from hash-based permalinks to GET-based

mgibbs189

{{gist file=”test.php” lang=”php”}}
<?php

// Add to your theme’s functions.php
function fwp_fix_links() {
?>
<script>
(function($) {
$(function() {
$(‘a[href*=”/#!/”]’).each(function() {
var href = $(this).attr(‘href’);
var new_href = href.split(‘/#!/’);
var url_vars = new_href[1].split(‘&’).map(function(val) {
return ‘fwp_’ + val;
});
new_href[1] = url_vars.join(‘&’);
$(this).attr(‘href’, new_href.join(‘/?’));
});
});
})(jQuery);
</script>
<?php
}
add_action( ‘wp_head’, ‘fwp_fix_links’, 50 );
{{/gist}}