Archived topic
Key Google Maps
7 replies · Started by noe_sp on August 17, 2020
Hello,
I've created an api key for a restrict domain.
In the website, I've created a new hook and put this code:
<script async defer src="https://maps.googleapis.com/maps/api/js?key=MY API KEY&callback=initMap"
type="text/javascript"></script>
wp_head, entire site and for all users, but I the map not works..
Thank you
Regards
Hi there,
Is that supposed to be in wp_head hook?
Can you link me to the instruction?
Hi there,
those links require a password.
However, that API key script needs to be added to the WP_footer.
You will then need to add the HTML for displaying the map in the content of your page or another Hook that comes before the WP_footer.
More detail here:
https://developers.google.com/maps/documentation/javascript/adding-a-google-map
https://drive.google.com/file/d/1rLyNhV8A42AuZpYznqeadbV7BspYrr1g/view?usp=sharing
https://drive.google.com/file/d/1F7ajO1uqhBgQaB86xiiGq6IGhsFKTUP4/view?usp=sharing
Now I think the link is public,
Thank you
Hi there,
The other info that David provided should help. The script should be added to wp_footer, and then you need to add the map HTML to the page.
You should just need to follow their instructions step by step to get it to work.
Hello,
I have done the indications and I continue with the same problem,
Thank you,
Regards
There is more to it then just adding the script.
In this link you will see there is a HTML element and an Init function that has to exist in the pages content.
Maybe use a Plugin to handle this