Forum Replies Created

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter Julie

    (@wonderfullie)

    `I made a search in my theme and I have only this line in my footer.php for the Google Maps API :

    <script src="https://maps.googleapis.com/maps/api/js?key=[MY KEY]" defer></script>

    Switching theme is kind of complicated because I have a lot of rewrite and custom post type directly in the theme. So, I tried to add your function in my function.php file and… It works !

    I don’t understand what your fonction do exactly, could you explain to me if I enconter the same problem again ?

    Thanks

    Thread Starter Julie

    (@wonderfullie)

    Sorry I didn’t have the time yet to check the script, but I update you tomorrow !

    Thank you again for your time.

    Thread Starter Julie

    (@wonderfullie)

    Indeed, I no longer have the error, but I still haven’t my Google Maps ??

    I really don’t understand where the problem can be. Is there a specific configuration I can try maybe ?

    Thread Starter Julie

    (@wonderfullie)

    Hi,

    I removed the htpasswd ! Google Maps is here : https://dev.media.eiwa.fr/magazine/
    Code, WordPress and all plugins are updated.

    Let me know if you need something else.

    And thank you again for your help !

    Thread Starter Julie

    (@wonderfullie)

    Ok so, I removed the enqueue and add the script below my map :

    <div data-service="google-maps" data-category="marketing" data-placeholder-image="https://local.media.eiwa.fr/wp-content/plugins/complianz-gdpr/assets/images/placeholders/google-maps-minimal-1280x920.jpg" id="me-maps-mag" class="me-ribbon me-gmaps" data-map-lat="43.6487851" data-map-lng="2.3435684" data-map-zoom="8"></div>

    <script type="text/javascript" >
        document.addEventListener("DOMContentLoaded", e => {
            initMap();
    
            function initMap() {
                const center = { lat: 43.6487851, lng: 2.3435684 }
    
                const map = new google.maps.Map(document.getElementById("me-maps-mag"), {
                    zoom: 8,
                    center: center,
                });
            }
        });
    </script>

    <script src="https://maps.googleapis.com/maps/api/js?key=[API KEY]" defer></script>

    When I inspect the code, the inline script have some data attributes :

    <script data-waitfor="initMap" type="text/plain" data-service="google-maps" data-category="marketing" src="https://maps.googleapis.com/maps/api/js?key=[KEY]" defer></script>

    I think it’s a good sign ?

    Google maps still doesn’t work, but error in my console are different :

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

    I made a search in the code and the inline script is the only match I can find for Google Maps API.

    I also have this error :

    
    Uncaught (in promise) TypeError: h is undefined
        Hea https://maps.googleapis.com/maps/api/js?key=[API KEY]:200
        promise callback*Hea/< https://maps.googleapis.com/maps/api/js?key=[API KEY]:199
        setTimeout handler*Hea https://maps.googleapis.com/maps/api/js?key=[API KEY]:199
        Load https://maps.googleapis.com/maps/api/js?key=[API KEY]:14
        <anonymous> https://maps.googleapis.com/maps/api/js?key=[API KEY]:329
        <anonymous> https://maps.googleapis.com/maps/api/js?key=[API KEY]:329
    js:200:14

    If I desactivate the plugin, my map works fine.

    • This reply was modified 2 years, 7 months ago by Julie.
    Thread Starter Julie

    (@wonderfullie)

    I just saw that I forgot some }); in the previous copy/paste but otherwise these are the only lines of code I have for my map implementation.

    <script type="text/javascript" >
        document.addEventListener("DOMContentLoaded", e => {
            initMap();
    
            function initMap() {
                const center = { lat: 43.6487851, lng: 2.3435684 }
    
                const map = new google.maps.Map(document.getElementById("me-maps-mag"), {
                    zoom: 8,
                    center: center,
                });
            }
        });
    </script>

    Also, I just noticed that once I refresh my page, after consent, I get the error again in my console:

    Uncaught ReferenceError: google is not defined
        initMap https://localhost:3000/magazine/ line 1 > injectedScript:19
        <anonymous> https://localhost:3000/magazine/ line 1 > injectedScript:3
        EventListener.handleEvent* https://localhost:3000/magazine/ line 1 > injectedScript:2
        cmplz_run_script https://localhost:3000/wp-content/plugins/complianz-gdpr/cookiebanner/js/complianz.min.js?ver=6.1.5:1
        cmplz_enable_category https://localhost:3000/wp-content/plugins/complianz-gdpr/cookiebanner/js/complianz.min.js?ver=6.1.5:1
        cmplz_enable_category https://localhost:3000/wp-content/plugins/complianz-gdpr/cookiebanner/js/complianz.min.js?ver=6.1.5:1
        cmplz_set_blocked_content_container https://localhost:3000/wp-content/plugins/complianz-gdpr/cookiebanner/js/complianz.min.js?ver=6.1.5:1
        conditionally_show_banner https://localhost:3000/wp-content/plugins/complianz-gdpr/cookiebanner/js/complianz.min.js?ver=6.1.5:1
        <anonymous> https://localhost:3000/wp-content/plugins/complianz-gdpr/cookiebanner/js/complianz.min.js?ver=6.1.5:1
    line 1 > injectedScript
    Thread Starter Julie

    (@wonderfullie)

    I tried this code too, but the problem is the same.

    The placeholder attributes are in my element, but the image doesn’t show. With or without consent… ??

    Thread Starter Julie

    (@wonderfullie)

    Thanks for your answer.

    I have to check with my client first to see if I can remove the restricted access.

    It’s a custom theme fully developed by myself. Google Maps API file is enqueue this way :

    wp_enqueue_script( 'maps-api', 'https://maps.googleapis.com/maps/api/js?key=[MY_API_KEY]');

    (Obviusly, with my real api key)

    At first, my function initMap() was in a global js script, but for testing I copy/paste it directly in my footer.php :

    <script type="text/javascript" >
        document.addEventListener("DOMContentLoaded", e => {
            initMap();
    
            function initMap() {
                const center = { lat: 43.6487851, lng: 2.3435684 }
    
                const map = new google.maps.Map(document.getElementById("me-maps-mag"), {
                    zoom: 8,
                    center: center,
            });
        });
    </script>

    And… that’s all !

    I forgot to mention that WordPress and Complianz are update.

    Thread Starter Julie

    (@wonderfullie)

    Thank you for the guide, unfortunatly this is exactly the one that I followed… ??

    I also try to deactivate all my plugins, except Shield Security of course, and the result is the same : I still don’t receive my custom email. And if I delete the original lp_2fa_email_code.twig, I receive an error (Could not render Twig with following Exception: Unable to find template “/email/lp_2fa_email_code.twig” (looked into: [project path]\web\app\plugins\wp-simple-firewall\/templates/twig).), plugin seems to not look for the file in my theme.

    Have you ever heard of conflits with some themes or configurations ? Because I really don’t understand where can be the problem.

    Thanks,

    Julie.

    Julie

    (@wonderfullie)

    Same issue here on all my websites (WordPress 5.3.2 and 5.0.2)…

    • This reply was modified 4 years, 8 months ago by Julie.
    Thread Starter Julie

    (@wonderfullie)

    The plugin is active on my local environment only, the website is in production but whithout StCR. Is that ok for you ? Where can I send you the URL in private ?

    Thread Starter Julie

    (@wonderfullie)

    Thanks for your answer.

    I’m not using any caching plugin. I’ve already tried to disable all my plugins exept StCR and the result is exactly the same… The problem appears in private navigation too, even with different browser.

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