Support

Account

Home Forums ACF PRO ACF Maps echo address without zip code

Unread

ACF Maps echo address without zip code

  • I’m wanting to display the address, but exclude the zip code. Google maps address string looks like this: 3658 NW Camas Meadows Dr, Camas, WA 98607. I’m not sure how to isolate the postal code since it isn’t separated by a comma. Any ideas? Here’s my code:

    <?php $address = get_field('address'); ?>
    <address class="street-address">
    <?php $location = explode( "," , $address['address']);
    echo $location[0].', '; //street number
    echo $location[1].','.$location[2]; //city, state 
    ?>
    </address>
Viewing 1 post (of 1 total)

The topic ‘ACF Maps echo address without zip code’ is closed to new replies.