Skip to content

Instantly share code, notes, and snippets.

View DylanCodeCabin's full-sized avatar

Dylan Auty DylanCodeCabin

View GitHub Profile
/**
* Custom script which handles loading remote images via Google Photos API
*
* Import your image photo references accordingly
*/
jQuery(function($){
WPGMZA.ProInfoWindow.prototype.open = function(map, feature)
{
var self = this;
/**
* Overrides the scroll functionality on marker listings
*/
jQuery(function($){
WPGMZA.MarkerListing.prototype.onItemClick = function(event) {
var marker_id = $(event.currentTarget).attr("mid");
var marker = this.map.getMarkerByID(marker_id);
var listingPushedInMap = WPGMZA.maps[0].settings.push_in_map && WPGMZA.maps[0].settings.push_in_map.length;
var clickedGetDirections = $(event.target).hasClass("wpgmza_gd");
jQuery(function(){
jQuery(window).load(function(){
WPGMZA.MarkerClusterer.prototype.redraw = function() {
WPGMZA.MarkerClusterer.log("redraw called", this);
this.map.clusterSepBridge = true;
if(typeof this.shouldRegenNVC === 'undefined'){
this.shouldRegenNVC = true;
}
jQuery(function($){
let bouncingMark = false;
$(document.body).on('mouseenter', '.wpgmaps_mlist_row', function(){
const map = WPGMZA.maps[0];
const markerId = $(this).attr('mid');
if(markerId){
if(bouncingMark !== markerId){
/**
* The following script allows custom field to be used as part of get variable filtering
*
* Create a custom field called 'id', set it to visible in info-window, and ensure your marker has the relevant field filled with a number
*
* Once done, add this script and append your variable as ?custom_id=1
*/
jQuery(function($){
$(document.body).on('markersplaced.wpgmza', function(){
/**
* This is an example of how you might manipulate a marker with WP Google Maps programattically
*
* The following code should be added to your theme's functions.php file
*
* Note: This is not conditional, meaning additional checks would need to be put in place for manipulation when a form is submitted for example
*/
/**
* Example of editing a marker title
<?php
/**
* This is an example of how you might add a marker to WP Google Maps programattically
*
* The following code should be added to your theme's functions.php file
*
* Note: This is not conditional, meaning a marker would be created each time the admin area initializes,
* you could easily change this to be conditional, or based on when a post is added to the map for example
*/
/**
* WP Google Maps makes use of the Google Maps API for map serving.
*
* The Google Maps API uses the Roboto webfont for some interface text within the map display
*
* The following script will hook into the insertBefore method and block Roboto from loading
*
* All credit to "coma" from this thread: https://stackoverflow.com/questions/25523806/google-maps-v3-prevent-api-from-loading-roboto-font
*/
/**
* This snippet acts as a small example of how you might access a map and:
* - Change center point
* - Change zoom level
* - Access a marker by it's ID
* - Create a custom Lat/Lng object
*/
jQuery(function($){
// Do not run if WPGMZA global is not available
@media (max-width: 420px) {
.site-description {
display: none;
}
}
@media (max-width: 979px) {
.site-title {
display: none;
}