• Resolved emellina

    (@emellina)


    Since we created and entered the Google API Key, there is the following issue:

    The Maps only shows when we reload the page on the browser; the first time the map area is just grey.

    IMPLICATIONS since our website is cached: the cache caches the first screen it sees i.e. the one with the greyed-out map.

    We cleared the cache and tried a few times but it’s still the same.
    However, when we are logged in WP, the cache is automatically disabled. So we first see the grey area; and when we reload the page the map finally shows up.

    Here is it: https://orchango.com/contact/

    https://www.ads-software.com/plugins/wp-google-maps/

Viewing 13 replies - 1 through 13 (of 13 total)
  • Hi there.

    It appears the Google Maps API is being loaded more than once on the page – as a result of this, an error is thrown and the map’s functionality is affected.

    Please visit our documentation on how to resolve this issue (https://www.wpgmaps.com/documentation/troubleshooting/how-to-solve-the-maps-api-loading-more-than-once-on-a-site/) and let me know if this helps at all?

    Thread Starter emellina

    (@emellina)

    Thanks Jarryd,
    We activated “Do not load the Google Maps API” and the map does show up now.
    However, it’s a plain map that doesn’t show our 3 office locations anymore. The main reason we used your pluggin (as opposed to the basic map embedded in our theme) was the ability to show the 3 locations (plus the neat colour controls).

    Therefore, the fix is not really working for us. Any other suggestions?

    Take care.

    Hi there

    The Google Maps API (loaded from your theme) seems to be loading after our scripts are run on the site.

    I would recommend taking a look in your theme’s functions.php file and see if you can find this Google Maps API call, and change it to load it in the head instead, by setting the last parameter of the wp_register_script to ‘true’

    Does this help at all?

    Thread Starter emellina

    (@emellina)

    Thanks Jarryd. We appreciate your help very much.

    Nothing in the theme’s function.php.
    However, we found the following in the theme’s footer.php – which seems to be a dynamic loading of the Google Maps API:

    ===
    https://maps.google.com/maps/api/js?sensor=false”
    ===

    Any advice?

    Looks like I’m not calling Google Maps API in the functions.php file. I’m simply using a shortcode for the map in a template php file. The maps seem to load on the website, but not in the wp-admin panel of the plugin itself.

    I just tried adding the following to my functions.php file without any success:

    add_action( 'wp_enqueue_scripts', 'add_google_maps_javascript' );
    function add_google_maps_javascript() {
      wp_enqueue_script(
        'twentyfifteen-maps-google-maps',
        'https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places&signed_in=true&key=MY_API_KEY',
        array(),
        '1.0.0',
        true
      );
    }

    Any suggestions?

    Ah yes. By adding it into the functions.php file, I introduce a new error:

    You have included the Google Maps API multiple times on this page. This may cause unexpected errors.

    Hi Perry.

    Our plugin will load the Google Maps API on the pages that contain the map on them. I have however responded to your ticket to assist you further with this.

    Thread Starter emellina

    (@emellina)

    Hi Jarryd,

    Not sure you saw my reply yesterday before perryazedo posted his 3 notes. Here is a copy for your convenience:

    Thanks Jarryd. We appreciate your help very much.

    Nothing in the theme’s function.php.
    However, we found the following in the theme’s footer.php – which seems to be a dynamic loading of the Google Maps API:

    ===
    https://maps.google.com/maps/api/js?sensor=false”
    ===

    Any advice?

    Thread Starter emellina

    (@emellina)

    Further to my above post, here is the complete command in the footer.php file:

    <?php wp_enqueue_script( “google_maps_api”, “https://maps.google.com/maps/api/js?sensor=false&#8221;); ?>

    Hi emellina

    Sorry I missed your post!

    Please comment out that enqueue and let me know if this helps?

    You can change that line of code to the following:

    <?php // wp_enqueue_script( "google_maps_api", "https://maps.google.com/maps/api/js?sensor=false"); ?>

    Thread Starter emellina

    (@emellina)

    Hi Jarryd,

    Sorry it took us so long to test it. We got carried away…

    Commenting out the line did the trick. Everything seems fine now.

    Thanks so much!!

    Hi @emellina

    Not a problem at all. Glad to hear you came right with this.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Greyed-out / Cache issue after Google API Key’ is closed to new replies.