facetwp replace listify map with map facet

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php
/** remove listify’s default map and replace with a map facet **/
add_action( ‘listify_output_map’, function() {
remove_action( ‘listify_output_map’, array( ‘Listify_Results’, ‘output_map’ ) );

}, 1 );

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’, ‘map’ ); ?>
</div>

</div>
<?php });

/**
* remove listify’s map script
*/
add_action( ‘listify_facetwp_sort’, function() {
wp_dequeue_script( ‘listify-map’ );
}, 20);
{{/gist}}{{gist file=”facetwp.json” lang=”json”}}
you use the below json to import a default map with basic settings configured for listify
in FacetWP -> Settings -> Backup

{“facets”:[{“name”:”map”,”label”:”map”,”type”:”map”,”source”:”cf/geolocation_lat”,”map_design”:”default”,”cluster”:”yes”,”limit”:”all”,”map_width”:”100%”,”map_height”:”100vh”,”min_zoom”:”1″,”max_zoom”:”20″,”default_lat”:””,”default_lng”:””,”marker_content”:”<p><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></p>”}]}
{{/gist}}