profile counter myspace
Website Design and Development | WordPress Development
Call Us Free: 1-877-792-0328

ACF and MapPress

I am working on a project where an import of content (using WP All Import) that has two fields in it. Lat and Long, and I needed to generate a Google map from it.

This setup uses ACF (Advanced Custom Fields) and MapPress. While you will not be creating maps individually as you normally would with MapPress you will need to install the plugin.

Here’s the code.

<?php $location1 = get_field('Address'); ?>
<?php $location2 = get_field('Lat'); ?>
<?php $location3 = get_field('Long'); ?>

<?php $mymap = new Mappress_Map(array("width" => 650)); ?>

<?php $mypoi_1 = new Mappress_Poi(array("title" => "", "body" => $location1, "point" => array("lat" => $location2, "lng" => $location3))); ?>

<?php $mymap->pois = array($mypoi_1);?>

<?php echo $mymap->display(array("directions"=>"none"));?>

  1. Hello,

    I’m working in a similar project and need to make a mashup map.
    Do you know if it’s possible by working as you did directly in PHP without the plugin inside the posts?

Leave a Reply

WordPress Code Tidbits


News & More