paullacey78
8/1/2017 - 2:28 PM

FacetWP single map in Beaver Builder page - using ACF map data (and also disable mouse wheel scroll)

FacetWP single map in Beaver Builder page - using ACF map data (and also disable mouse wheel scroll)

<?php

/* FaceWP get current post ID for single view map placement */
add_action( 'wp_head', function() {
global $post;
	?>
	<script>
	(function($) {
	    $(document).on('facetwp-refresh', function() {
	        FWP_HTTP.post_id = '<?php echo $post->ID; ?>';
	    });
	})(jQuery);
	</script>
	<?php
}, 100 );


/* FaceWP disable map mouse wheel scrolling */
add_filter( 'facetwp_map_init_args', 'prefix_prevent_scroll_zoom_on_facet_map' );
/**
 * Filter the Google Map options to prevent scrollwheel zoom.
 * @link https://craigsimpson.scot/filter-facetwp-google-map-options
 *
 * @param array $args Array of init settings for Google map.
 *
 * @return array $args Modified array.
 */
function prefix_prevent_scroll_zoom_on_facet_map( $args ) {
 $args['scrollwheel'] = false;
 return $args;
}
<?php
/* What I have in my facet template */
return array(
  "post_type" => "delivery_partners",
  "post_status" => "publish",
  "orderby" => "title",
  "order" => "ASC",
  "posts_per_page" => 50
);