Recently, a client contacted me to make a few modifications on their website. Now consider that I’m not the person who made this website. It was supposed to be easy ; add a few lines here and there, change the contact information, update the address shown on the google maps and voilà !
But unfortunately, things didn’t go so well for that last part. When you go on their website, in the contact page you see this google maps and a pin on it with the address attached. I thought “it’s probably inserted either via a plugin or manually on the page”. Turns out it’s neither ! I cannot find a single trace of google maps on this website’s configuration. Same on the page, there is nothing that indicates that a google maps was inserted, and I really need to change this address, but quite frankly I don’t know how to.
(This might be a bit of stupid question, I’m still a student at the moment and I haven’t done WordPress in a looong while.)
I don’t really know what I can share to make answering this question easier, because of the client’s privacy. One thing I can do for sure though is let you know which plugins are already installed (maybe it’s in one of them and I missed it ?) :
- Akismet Anti-Spam
- All in One SEO Pack
- BackWPup
- Contact Form 7
- Custom Login Page Customizer
- Event Espresso
- Event Espresso – Grid View Template
- Fancy Gallery
- Flamingo
- iframe
- iThemes Security
- MimeTypes Link Icons
- Really Simple SSL
- Slider Revolution
- TinyMCE Advanced
- WP Mail SMTP
Sorry if this is very vague, feel free to ask questions back ! Thank you for your time.
Edit : I don’t know if it’s really worth mentioning, but when I load the page, it gives me an error from Google saying “This page can’t load Google Maps correctly.”
Edit : Okay, so as @Rup suggested, I’ve found some information when I looked into the source code for the page. Turns out I found this (some values were changed to keep the location and website private) :
<input type="hidden" id="skt-gmap-content" value="The address" />
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script type="text/javascript">
var marker;
var map;
var ele;
jQuery(document).ready(function() {
ele = "";
var contstring = jQuery('#skt-gmap-content').val();
var lines = contstring.split(/n/g);
for(var i=0; i < lines.length; i++) {
ele += lines[i];
}
});
function sktinitializemap()
{
var contentStringEle = ele;
var contentString = contentStringEle;
var image = 'blue-marker.png';
var infowindow = new google.maps.InfoWindow({content: contentString,maxWidth: 300}); // info-window text
var myLatLng = new google.maps.LatLng('this','that'); // address in the form of latitude/lognitude
var mapOptions = {
zoom: 17,
scrollwheel: false,
center: myLatLng,
mapTypeControl: true,
panControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
},
zoomControl: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.LARGE
},
mapTypeId: google.maps.MapTypeId.ROADMAP }
map = new google.maps.Map(document.getElementById('map'),mapOptions);
// add google map marker
marker = new google.maps.Marker({
position: myLatLng,
map: map,
icon: image,
title:"The address",
animation: google.maps.Animation.BOUNCE });
// open info-window at marker click event
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
// check info-window status
infowindow.open(map,marker);
skt_moveMap(skt_moveMap, 10);
}
function skt_moveMap() {
map.panBy(0, -100);
}
// initialize the map at window load event
google.maps.event.addDomListener(window, 'load', sktinitializemap);
</script>
Now I don’t know if this code was implemented manually or if a plugin did it, cause I really can’t find more info than this. By the look of the variables’ names and comments, I’d say it was done by hand but I wouldn’t know where the file is located. I’m gonna try and dig around the files to find it.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
The map is output in the page template. A search of Github for the term skt_moveMap() (which seemed like a unique function name) revealed that the Google Maps code from your question is part of the “Contact page Template with Sidebar” (template-contact-with-sidebar.php) or “Contact page Template” (template-contact-page.php) templates included in themes from SketchThemes.
Looking at this template I could see that the map position was determined by the theme’s settings, and I was able to find where those were simply by going to the theme author’s website, going to their documentation, and selecting one of the theme’s I’d found. That documentation clearly shows where these settings are.
Checking your plugin or theme’s support resources should always be the first place to look.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0