Support

Account

Home Forums Front-end Issues Map pin not centering

Helping

Map pin not centering

  • Hi, We have a custom field in a post that allows users to select one location which is getting stored correctly however, when displaying the map the zoom is such that the pin is getting shifted into the top left corner of the map which makes it appear as if the map is empty.

    Here is the code used to display the field in the template:

    <?php if (get_field('map')): ?>
                            <div id="detail-info-map">
                                <?php $location = get_field('map'); ?>
                                <iframe width="582" height="400" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f=q&source=s_q&s11=<?= $location[lat];?>,<?= $location[lng];?>&hl=en&geocode=&q=<?php echo the_field('map') ?>;t=m&z=10&iwloc=A&output=embed&iwloc=near"></iframe>
                            </div>
                        <?php endif ?>

    As you can see, I even tried centering by adding in the s11 lat and long co-ordinates but that doesn’t work either.

    Is there a better way of displaying the map within a php template?

    thanks.

  • I have the same iisue, have you found solution?

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

The topic ‘Map pin not centering’ is closed to new replies.