• Hi Camille.

    Some time ago I was developing my website but I stopped it. (but I wrote all the steps I did, so it would be easy to re-create the website). Now I am trying to set the actual user location, but I am unable…

    I copied this before the </head> tag in the header.php

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
    
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/L.Control.Locate.min.css" />

    And tried to copy this before the </body> tag in the footer.php

    <script src="https://cdn.jsdelivr.net/npm/[email protected]/src/L.Control.Locate.min.js" charset="utf-8"></script>
    
    <script>
    document.addEventListener('cttm_map_loaded', function (e) {
      for (var i = 0; i < cttm_map.length; i++) {
        L.control.locate().addTo(cttm_map[i]);
      }
    }, false);
    </script>

    But the </body> tag is not there!…. the footer.php doesn’t have that tag anymore…

    What should I do?

    • This topic was modified 3 years, 3 months ago by wilmart.
Viewing 1 replies (of 1 total)
  • Plugin Author Camille V

    (@socrapop)

    Dear @wilmart,

    If you can’t find your closing body tag, you can still add the code you copied here, below your code added in header.php.

    It will still work, but the page will need the script to be loaded before showing anything on the page (increasing loading time for small bandwidth, but invisible for good internet speed).

    But the closing body tag should be somewhere in your theme, or it would mean it’s not valid HTML (browsers these days are very forgiving and tend to automatically add a closing tag when there is none)

Viewing 1 replies (of 1 total)
  • The topic ‘Set actual user location’ is closed to new replies.