Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi,

    Glad you’re enjoying the plugin!

    Can you tell us a bit more about what you want to do? Sounds like you want to remove the search form completely and just rely on geolocation?

    Thread Starter momoed

    (@momoed)

    Thanks for answer,

    I don’t want to remove the search form, I want to add geolocation in the form, for example, by clicking the button above the marker location field and have the address directly without the need to write. But leave the choice anyway to user to write manually his location.

    Hiya,

    Do you mean when adding an event?

    If so, I believe the best thing for you to do is build your own method of selecting the location from a map, and an API (such as Google Maps) to fill the relevant location fields that EM expects to receive.

    You can so this by providing customised templates for the form. See https://wp-events-plugin.com/documentation/using-template-files/

    Cheers,
    Phil

    Thread Starter momoed

    (@momoed)

    Hi Phil,

    When an event is created , user must inform his location. In my home page, I’ve the search form with location field. I want integrate the address automatically in this field when user click on the button “Get current location” for example,therefore when he send his location , events near his city appear.

    What you’d need to do in that case is write some custom code that finds the user location using the HTML5 geolocation feature and adds the address to the Events Manager search box using jQuery.

    This should help with getting the user location:
    https://www.w3schools.com/html/html5_geolocation.asp

    Thread Starter momoed

    (@momoed)

    hi,

    I implemented geolocation but I can’t integrate the values ??in the location box using jQuery. Could you help me for that?

    Thanks

    Thread Starter momoed

    (@momoed)

    This is the code :

    function getLocation()
      {
      if (navigator.geolocation)
        {
        navigator.geolocation.getCurrentPosition(showPosition, showError);
        }
      else{alert("Geolocation is not supported by this browser.");}
      }
    
    function showPosition(position)
      {
     var lat=position.coords.latitude;
     var lng=position.coords.longitude;
     var geocoder = new google.maps.Geocoder();
     var latlng = new google.maps.LatLng(lat, lng);
     var addr =
     geocoder.geocode({'latLng': latlng}, function(results, status) {
          if (status == google.maps.GeocoderStatus.OK) {
    	var numero = results[0].address_components[0].long_name;
    	var rue = results[0].address_components[1].long_name;
    	var codeP = results[0].address_components[6].long_name;
    	var ville = results[0].address_components[2].long_name;
    	var adresse = numero+" "+ rue + " "+ codeP +" "+ ville;
    	alert(adresse);
    
          }else{
    	alert("Le geocodage n\'a pu etre effectue pour la raison suivante: " + status);
          }
     });
    }

    That’s not something we can really help you with here as this is only for plugin support, not custom development.

    You might want to try places like StackExchange for that

    Thread Starter momoed

    (@momoed)

    Thanks , I’ve included the address in the correct field. But I have to click on the pre-written address to select the autocomplete address and therefore launch search.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Geo my wp integration’ is closed to new replies.