Support

Account

Home Forums Feature Requests Break out information in Google Maps API

Helping

Break out information in Google Maps API

  • 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.

  • 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)

The topic ‘Break out information in Google Maps API’ is closed to new replies.