Support » Fixing WordPress » Google Maps API

  • Resolved wowzimmer


    I’ve been trying to get Google Maps to load in individual posts using the Google API but the map ends up broken every time!

    I know the Javascript is sound – when I load it on a plain HTML page it works perfectly.

    I understand that loading Javascript can be a little more complicated in WordPress. I have finally learnt how to register and enqueue the Google Maps API javascript libraries and that is sitting nicely in this themes functions.php file.

    I have created a couple of .js files for two maps and referenced them in my themes header.

    In the WordPress posts I have simply used the CSS classes for the two maps to call the javascript. But every time, the map just doesn’t work properly. The infoboxes don’t open properly, the street view pegman disappears and a multi-coloured box appears in the middle of the map.

    I’ve tried loading the javascript file directly in the post and even pasting all the javascript directly into the post. I still get the same problem.

    In terms of trouble shooting I’ve already switched my theme back to twentytwelve and twentyeleven but it makes no difference.

    Does anybody know what I might be missing here? It’s caused me a significant amount of grief so far and I am no further forward!!!!

    Many thanks

Viewing 1 replies (of 1 total)
  • #map img{max-width: inherit;}

    Got the answer from StackOverflow. Was convinced that I had messed up loading the Javascript into WordPress as it seems like such a complicated task compared to basic HTML. I hadn’t even considered CSS but am pleased to report that this did the trick!

Viewing 1 replies (of 1 total)
  • The topic ‘Google Maps API’ is closed to new replies.