• Resolved sam98brown

    (@sam98brown)


    Hi there.

    Having trouble getting a plugin to play nice with Google Maps. I’m getting the “google is undefined” error.

    So i went to script centre, added google maps as a custom script with this url:
    https://maps.googleapis.com/

    Also added my plugin folder:
    https://mylocalsite.six/wp-content/plugins/propertyhive-map-search/

    And set the dependency so the plugin folder waits for google maps.

    However nothing changes, and it doesnt look like the plugin is being loaded by Complianz, looking at the network tab in dev tools.

    Can you advise me on how best to set this up? It would be good to see a visual example/tutorial of how to block plugins in script centre as I’m not sure I’m entering the URLs correctly. I’ve also tried blocking the individual .js files but no luck there.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Jarno Vos

    (@jarnovos)

    Hi @sam98brown,

    I’ve checked and found that there is an already existing integration with the Property Hive Google Map, available on our integrations GitHub here: https://github.com/Really-Simple-Plugins/complianz-integrations/blob/master/property-hive.php

    You can upload that PHP file to the folder /wp-content/mu-plugins/ folder on your website, after which this integration will automatically be enabled.

    Note that since the Property Hive map doesn’t have a div class we can use to target and add the placeholder, the placeholder is added to a div with class “cmplz-maps-placeholder” instead. As that class doesn’t exist yet, you will have to add the “cmplz-maps-placeholder” class to the Google Map element. In the Gutenberg editor for example, this is done by selecting the block and navigating to Advanced > Additional CSS Classes in the right-hand side menu.

    For good measure, please disable the custom integration you had previously created in the Script Center when testing the above MU Plugin.

    Please also find the documentation on how to integrate scripts/plugins within the Complianz Script Center attached here: https://complianz.io/integrating-plugins/

    Kind regards,
    Jarno

    • This reply was modified 3 years, 11 months ago by Jarno Vos.
    • This reply was modified 3 years, 11 months ago by Jarno Vos.
    Thread Starter sam98brown

    (@sam98brown)

    Hey Jarno

    Thanks for the help here.

    Does the Google Maps service need to be enabled for this to work? I’ve cleared my custom integration and set this file up in mu-plugins but no luck. The file is definitely running as I ran a die(); command to check.

    Plugin Contributor Jarno Vos

    (@jarnovos)

    Hi @sam98brown,

    I made a small change in the integration file on GitHub, so that it uses the correct URL for the Maps API. Can you give this new version a try as well? I wouldn’t expect that having the Google Maps service enabled/disabled will make a difference in this case.

    In addition, could we perhaps see the current state of the Google Map on the website in question? If we can see why it breaks (or doesn’t), that often helps to point us in the right direction.

    Kind regards,
    Jarno

    Thread Starter sam98brown

    (@sam98brown)

    Hi Jarno

    Here’s the console error:

    Uncaught ReferenceError: google is not defined
        <anonymous> https://mysite.six/wp-content/plugins/propertyhive-map-search/assets/js/ph-map-search.js?ver=1.1.31:586
    ph-map-search.js:586:1

    This file calls the function:
    propertyhive_init_map

    Is this any help?

    • This reply was modified 3 years, 11 months ago by sam98brown.
    Plugin Author Aert

    (@aahulsebos)

    Hi @sam98brown,

    We can do the following; https://propertyhive.us8.instawp.xyz/index.php/property/10-knoll-garth-bury-st-edmunds/

    The issue remains, which is adding a placeholder. As it now only shows when accepting on the banner.

    In my example I have <div id="property_map_canvas" style="height:400px"></div> and we need a class to add the placeholder.

    Altering the <div> however will throw an error, as the div element is not as expected when initializing the map.

    Maybe the fastest way would be asking PropertyHive if there’s an easy way of adding a class, even for styling this could make sense.

    regards Aert

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Block plugin’ is closed to new replies.