added marker cluster
This commit is contained in:
@@ -15,7 +15,9 @@ Author URI:
|
||||
*/
|
||||
|
||||
$mp_api_key = 'AIzaSyCvdGV2ssD4ov4a9CuIlQhoJyz5gWWiSvE';
|
||||
$mp_marker_icon = '/wp-content/plugins/map_prof/marker.png';
|
||||
$mp_icon_url = '/wp-content/plugins/map_prof/marker.png';
|
||||
$mp_icon_size = [50, 50];
|
||||
$mp_icon_label_color = "red";
|
||||
|
||||
|
||||
|
||||
@@ -34,11 +36,15 @@ require_once(dirname(__FILE__) . '/mp_add_to_scripts.php');
|
||||
*/
|
||||
|
||||
function mp_enqueue_scripts() {
|
||||
wp_enqueue_style( 'mp_style', plugins_url('mp_style.css', __FILE__), '', '', '');
|
||||
wp_enqueue_script('mp_init_map', plugins_url('mp_init_map.js', __FILE__), '', '', true);
|
||||
wp_enqueue_script('mp_google_api', mp_url_api(), ['mp_init_map'], '', true);
|
||||
mp_get_locations();
|
||||
mp_get_markers();
|
||||
// https://developers.google.com/maps/documentation/javascript/marker-clustering
|
||||
$marker_clusterer = "https://unpkg.com/@googlemaps/markerclusterer/dist/index.min.js";
|
||||
|
||||
wp_enqueue_style( 'mp_style', plugins_url('mp_style.css', __FILE__), '', '', '');
|
||||
wp_enqueue_script('mp_marker_clusterer', $marker_clusterer, '', '', true);
|
||||
wp_enqueue_script('mp_init_map', plugins_url('mp_init_map.js', __FILE__), ['mp_marker_clusterer'],'', true);
|
||||
wp_enqueue_script('mp_google_api', mp_url_api(), ['mp_init_map'], '', true);
|
||||
|
||||
mp_add_to_scripts();
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'mp_enqueue_scripts' );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user