facetwp replace listify map with facet’s map facet

djrmom

{{gist file=”functions.php” lang=”php”}}
<?php
/** you will need to create a map facet and make sure you use that name in
* facetwp_display( ‘facet’, ‘my_map_name’ )
* use geolocation_lat as the datasource in the facet’s settings
*/

/**
* remove listify’s map
**/
add_action( ‘listify_output_map’, function() {
remove_action( ‘listify_output_map’, array( ‘Listify_Results’, ‘output_map’ ) );

}, 1 );

/**
* substitute facet’s map facet
*/
add_action( ‘listify_output_map’, function() { ?>
<div class=”job_listings-map-wrapper listings-map-wrapper–<?php echo esc_attr( get_theme_mod( ‘listing-archive-map-position’, ‘side’ ) ); ?>”>

<div class=”job_listings-map”>
<?php echo facetwp_display( ‘facet’, ‘my_map_name’ ); ?>
</div>

</div>
<?php });

/**
* remove listify’s map script
*/
add_action( ‘listify_facetwp_sort’, function() {
wp_dequeue_script( ‘listify-map’ );
}, 20);
{{/gist}}