FacetWP – update an dynamically based on proximity data

mgibbs189

{{gist file=”test.js” lang=”javascript”}}
<script>
(function($) {
$(document).on(‘facetwp-loaded’, function() {
var title = ‘Campgrounds and RV parks’;
if (0 < FWP.facets.location.length) {
title += ‘ within ‘ + FWP.facets.location[2] + ‘ miles of ‘;
title += decodeURIComponent(FWP.facets.location[3]);
}
$(‘.my-title’).html(title);
});
})(jQuery);
</script>
{{/gist}}