Support

Account

Home Forums Feature Requests Break out information in Google Maps API

Helping

Break out information in Google Maps API

    • qwik3r

    • August 8, 2019 at 6:31 am

    I’m sure this has been talked about, and I have seen posts for help with it in the forum, but I’d like to formally request (unless it’s already been done, couldn’t find it…) a way to have the Google Maps API information broken out so that the information can be used in other ways. Right now the array that ACF outputs contains the city, state, zip and lat/long. You can only separate out the city, state and zip into one text string. I would like to just have the state for example so I can filter by that.

    Not sure if this is a limitation of the data you receive from the API itself or what but it would be helpful!

    Thanks.

    • James

    • August 12, 2019 at 6:03 am

    Hi @qwik3r

    Please take a look at the below example on how to separate the string values:

    <?php 
    // vars 
    $contact_address = get_field('business_google_map', 'option'); 
    ?> 
    
    <?php $address = explode( "," , $contact_address['address']); 
    echo $address[0].', '; //street number 
    echo $address[1].', '; //city 
    echo substr($address[2],0,3).substr($address[2],3,6); //state + zip 
    ?>
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.