Skip to content

Instantly share code, notes, and snippets.

View DylanCodeCabin's full-sized avatar

Dylan Auty DylanCodeCabin

View GitHub Profile
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 thos 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
/**
* 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
*/
function custom_wpgmza_create_marker(){
/**
* 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
*/
@media (max-width: 420px) {
.site-description {
display: none;
}
}
@media (max-width: 979px) {
.site-title {
display: none;
}
jQuery(function(){
jQuery(document.body).on("infowindowopen.wpgmza", function(e){
jQuery(".wpgmza-infowindow p").each(function(){
var customFieldTitle = jQuery(this).data("custom-field-name");
if(customFieldTitle){
jQuery(this).html("" + customFieldTitle + ": " + jQuery(this).text());
}
});
});
jQuery(function($){
var lastMarkerId = false;
var scaleMultiplier = 1.3;
$(document.body).on('infowindowopen.wpgmza', function(e){
var tmarkid = e.target.mapObject.id;
var tmapid = e.target.mapObject.map_id;
if(lastMarkerId !== tmarkid){
@DylanCodeCabin
DylanCodeCabin / custom.css
Created September 27, 2019 07:13
Patrick Henry Custom listing
.wpgmza_special_listing {
text-align: center;
width: 60%;
margin-left: auto;
margin-right: auto;
}
.wpgmza_special_listing .wpgmza_special_col{
width: 50%;