Skip to content

Instantly share code, notes, and snippets.

@PerryRylance
Last active September 23, 2019 08:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PerryRylance/591a3519632e6953477ec4786a46e1fe to your computer and use it in GitHub Desktop.
Save PerryRylance/591a3519632e6953477ec4786a46e1fe to your computer and use it in GitHub Desktop.
WP Google Maps - Pro add-on - Prevent infowindow opening when marker shortcode attribute used
jQuery(function ($) {
$(window).on("init.wpgmza", function(event) {
WPGMZA.ProMarker.prototype.onAdded = function (event) {
var m;
WPGMZA.Marker.prototype.onAdded.call(this, event);
this.updateIcon();
if (this.map.storeLocator && this == this.map.storeLocator.marker)
return;
if (this == this.map.userLocationMarker)
return;
if (this.map.settings.store_locator_hide_before_search == 1 && WPGMZA.is_admin != 1) {
this.isFiltered = true;
this.setVisible(false);
return;
}
if (
WPGMZA.getQueryParamValue("markerid") == this.id
||
this.map.shortcodeAttributes.marker == this.id) {
// this.openInfoWindow();
this.map.setCenter(this.getPosition());
}
if ("approved" in this && this.approved == 0)
this.setOpacity(0.6);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment