Support

Account

Forum Replies Created

  • Hi,

    Using this code:

    $map_posts = get_posts(array(
        'post_type' => 'post',
        'cat' => '8'
    ));
    
    if( $map_posts ): ?>
        <div class="acf-map">
            <?php foreach( $map_posts as $map_post ) : 
    
                $location = get_sub_field('location', $map_post->ID);
    
                ?>
                <div class="marker" data-lat="<?php echo $location['lat']; ?>" data-lng="<?php echo $location['lng']; ?>">
                    <h4><?php the_sub_field('title'); ?></h4>
                    <p class="address"><?php echo $location['address']; ?></p>
                    <p><?php the_sub_field('description'); ?></p>
                </div>
        <?php endforeach; ?>
        </div>
    <?php endif; ?>

    Is there a way to show nearby locations? Like by a radius of 20 miles, for example?

    P.s. Thank you so much for the code, it works great!

  • Hi Pepe,

    When entering the address, enter the full address then simply include zip, country, and continent.

    Instead of -> 100 Universal City Plaza, Universal City, CA
    Type -> 100 Universal City Plaza, Universal City, CA 91608, USA, North America

    I tested this out and it works.

    All the best,
    thecodeguy

Viewing 2 posts - 1 through 2 (of 2 total)