Created
July 24, 2018 20:19
-
-
Save djrmom/4043e6b0ad774de8514ca5e0daed8a75 to your computer and use it in GitHub Desktop.
facetwp auto enable filtering button on map
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 | |
/** | |
** 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