json facetwp用map facet替换listify map

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了json facetwp用map facet替换listify map相关的知识,希望对你有一定的参考价值。

<?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);
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>"}]}

以上是关于json facetwp用map facet替换listify map的主要内容,如果未能解决你的问题,请参考以下文章

php facetwp用facet sort替换woocommerce排序

php facetwp facetwp_facet_filter_posts钩子

php facetwp修改facet计数

php facetwp在autoselect上重置facet

php facetwp将标签添加到类别facet

css facetwp层次结构facet css样本