Skip to content

Instantly share code, notes, and snippets.

@djrmom
Created July 24, 2018 20:19
Show Gist options
  • Save djrmom/4043e6b0ad774de8514ca5e0daed8a75 to your computer and use it in GitHub Desktop.
Save djrmom/4043e6b0ad774de8514ca5e0daed8a75 to your computer and use it in GitHub Desktop.
facetwp auto enable filtering button on map
<?php
/**
** enable filtering on load of map
**/
add_action( 'wp_footer', function() {
?>
<script>
(function($) {
$(document).on('facetwp-loaded', function() {
var filterButton = $( ".facetwp-map-filtering" );
if ( !filterButton.hasClass('enabled') && 'undefined' == typeof FWP_MAP.enableFiltering ) {
filterButton.text(FWP_JSON['map']['resetText']);
FWP_MAP.is_filtering = true;
filterButton.addClass('enabled');
FWP_MAP.enableFiltering = true;
}
});
})(jQuery);
</script>
<?php
}, 100 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment