facetwp table sorter plugin compat

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php
/**
** re-run table sorter init after refreshing facets
** https://wordpress.org/plugins/table-sorter/
**/
add_action( ‘wp_head’, function() { ?>

<script>
(function($) {
$(document).on(‘facetwp-loaded’, function() {
$(‘.tablesorter .sortless’).addClass(‘{sorter: false}’);
$(‘.tablesorter’).tablesorter({
sortLocaleCompare: true
});
});
})(jQuery);
</script>

<?php } );
{{/gist}}