0

I'm trying to get the location of X through an API and show it to the user in a Google Maps.

Im my template file I have a button (id is the $teamid):

<div class="marshal-button">
    <a class="fep-button" id="1" href="#">Localise this team</a>
</div>

In my functions.php file I have a function like this:

function get_location($teamid)
{
    /*** Some code to get the location ***/
    $latitude = $response['latitude'];
    $longitude = $response['longitude'];

    return [$latitude, $longitude];
}

How can I call this function and return latitude and longitude and show it in a Google map?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.