Google Maps WordPress (5 posts)

  1. Droic
    Posted 3 years ago #

    Hello, I am trying to create a map that is exactly like the district map found at followthemoney.org here: http://www.followthemoney.org/database/StateGlance/district.phtml?s=Mt&px=46.5944922&py=-112.047218

    I can get the code to run in HTML pretty well: http://joelwilsonmt.com/test/test.html

    but I cannot get that same script to function in wordpress. I have tried putting it directly into the child theme files (script includes in header, then in body of page have the rest of the scripts), and also inserting it as HTML into a post.

    Any help as to how to do this would be greatly appreciated as almost all of the google maps plugins do not support highlighting an area.

  2. Peter_L
    Posted 3 years ago #

    Could you show the test you ran in WP?

  3. Droic
    Posted 3 years ago #

    Here you go:

    As you can see, it makes space for the map and the code is in the source, but the map comes up blank.

  4. Peter_L
    Posted 3 years ago #

    In the wp version: the JS on lines 13 and 14 in your source code have a wrong src. You use a relative url while you're in a different directory. So either use a correct relative path or an absolute path.

    That's a problem, could be others too.

    I also noticed you load the api key twice. Not sure if that's necessary but I could be wrong. I've never worked with google maps api.

  5. Droic
    Posted 3 years ago #

    OK - I think this is the right way to do it, I just can't figure it out (being a newb to Google APIs):


    Now I just need to figure out how to implement this (a much more simple solution) - even when I copy the source to my local hard drive and try to use my own coordinates (or even copy the example coordinates) the map does not show up. Maybe that's something to do with incorrect google APIs?

Topic Closed

This topic has been closed to new replies.

About this Topic