Skip to content

Instantly share code, notes, and snippets.

@DylanCodeCabin
Created September 27, 2019 07:13
Show Gist options
  • Save DylanCodeCabin/92c5d4f14969dee14f71a7e338a58d4f to your computer and use it in GitHub Desktop.
Save DylanCodeCabin/92c5d4f14969dee14f71a7e338a58d4f to your computer and use it in GitHub Desktop.
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%;
display: inline-block;
vertical-align: top;
}
.wpgmza_special_listing .wpgmza_special_col h4{
font-size: 1.4em;
margin-top: 40px;
}
.wpgmza_special_listing .wpgmza_special_col .wpgmza_custom_marker_row{
cursor: pointer;
margin-bottom: 5px;
}
.wpgmza_special_listing h2 {
font-size: 2em;
font-family: "Merriweather",serif;
color:#253042;
text-transform: initial;
position: relative;
top: 20px;
}
jQuery(window).load(function(){
if(typeof WPGMZA.maps !== 'undefined' && typeof WPGMZA.categories !== 'undefined'){
for(var mapI in WPGMZA.maps){
var cMap = WPGMZA.maps[mapI];
if(typeof cMap.markers !== 'undefined'){
var cats = {};
for(var catI in WPGMZA.categories.children){
cats[WPGMZA.categories.children[catI].id] = {
name: WPGMZA.categories.children[catI].name,
markers: []
};
}
for(var markI in cMap.markers){
var cMark = cMap.markers[markI];
if(typeof cMark.categories !== 'undefined' && typeof cMark.categories[0] !== 'undefined'){
if(typeof cats[parseInt(cMark.categories[0])] !== 'undefined'){
cats[parseInt(cMark.categories[0])].markers.push(cMark);
}
}
}
if(typeof cMap.element !== 'undefined' && typeof cMap.element.id !== 'undefined'){
/** Build the list sit */
var html = "<div class='wpgmza_special_listing'>";
html += "<h2>Our Vision 30 Partners</h2>";
for(var i in cats){
html += "<div class='wpgmza_special_col'>";
html += "<h4>" + cats[i].name + "</h4>";
for(var mi in cats[i].markers){
html += "<div class='wpgmza_custom_marker_row' mid='" + cats[i].markers[mi].id + "' mapid='" + cMap.id + "'>";
html += cats[i].markers[mi].title;
html += "</div>";
}
html += "</div>";
}
html += "</div>";
jQuery(html).insertAfter('#' + cMap.element.id);
jQuery('.wpgmza_marker_list_class,.wpgmza-pagination').hide();
}
}
}
}
jQuery('body').on('click', '.wpgmza_custom_marker_row', function(){
WPGMZA.getMapByID(jQuery(this).attr('mapid')).getMarkerByID(jQuery(this).attr('mid')).openInfoWindow();
WPGMZA.getMapByID(jQuery(this).attr('mapid')).setCenter(WPGMZA.getMapByID(jQuery(this).attr('mapid')).getMarkerByID(jQuery(this).attr('mid')).getPosition());
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment