Skip to content

Instantly share code, notes, and snippets.

@DylanCodeCabin
Last active January 11, 2023 08:54
Show Gist options
  • Save DylanCodeCabin/d28b3beaedef98c770ff6897980319ff to your computer and use it in GitHub Desktop.
Save DylanCodeCabin/d28b3beaedef98c770ff6897980319ff to your computer and use it in GitHub Desktop.
const customMapId = 1;
/* An array with objects, each object represents a marker */
const customMarkerData = [
{
title : "Example Title",
address: "Example Address",
map_id: customMapId,
lat: 41.973052569247955,
lng: -120.2621297558594,
description: "Description",
}
];
jQuery(function($){
$(document.body).on('markersplaced.wpgmza', () => {
const map = WPGMZA.getMapByID(customMapId);
if(map){
for(let i in customMarkerData){
const data = customMarkerData[i];
const instance = WPGMZA.Marker.createInstance(data);
map.addMarker(instance);
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment