Default to Map view on Contact Us page

Latest Reply from Betteridge at 2016-07-06 14:13:54 Solution
How do I change the default map view on the "Contact us" page of the Hotels theme, to Map view instead of Satellite view?
Hi!

Unfortunately, there is no option to set the ROADMAP type by default in the theme. But perhaps, you can use this google article to change settings.

https://developers.google.com/maps/documentation/javascript/maptypes?hl=en
I developed the site on my local host and all was working well. Uploaded to my live domain, but now my on the contact us page doesn't show at all.

Any ideas?

Live site can be viewed on www.68onhofmeyr.co.za
Hi!

I have visited your website and checked an issue. It seems that you have made some changes including deleting a part of code. Try to return your changes to detect it. And I have also found the MissingKeyMapError error in the browser console. This error can be a reason too.
Hi Grace, thanks for your reply. I haven't changed any code in the template. I even tried to reinstall a fresh copy of the template, but it still doesn't show the map.

How do I correct the MissingKeyMapError?
I found the following article when I dis a Google search for MissingKeyMapError - https://wordpress.org/support/topic/google-maps-api-error-missingkeymaperror-1

I created an API key, but where do I add it into the code to display on my SMThemes template?
Hi!

To add your API key, you need to:

1. Open the library.php file in the following directory:
\www\wp-content\themes\luxurycars\inc

2. Find the next part of code:
wp_register_script( 'googlemaps', 'https://maps.google.com/maps/api/js', array( 'jquery' ), '3' );


3. And replace it with the next one:

wp_register_script( 'googlemaps', 'https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap', array( 'jquery' ), '3' );


You need to use your key instead of the YOUR_API_KEY words.
Thank you Grace, you are a STAR!!!!

Still no way to change the theme's default map view from Satellite to Map?
Hi!

As I said before, there is no option to set the ROADMAP type by default in the theme, but you can do it by editing the theme files. To change the map type you need to:

1. Open the smthemes.js file in the following directory:
\www\wp-content\themes\luxurycars\js

2. Find the HYBRID text and change it to the ROADMAP one.
Worked like a charm ... thanks a million Grace

Leave a reply

Add codeAdd image