I set up the map using the map meta box in a single custom post type.
The main map works great on the home page.

I want to now show the map with the single location on the single posts that have the location set.
Is this possible?

Public
No, this is not possible, our plugin works on a basis of shortcode so you need to create a single locations map and insert shortcode in a single page.

I hope it helps you.

Thanbks
#1
Public
I found a way to do this if you're comforable coding up your own CPT template file.

I wanted to have each custom post page have a map with a single marker on it, and have a page with ALL markers, linking back to the single marker post page.

I did this in the custom post type template file:


global $wpdb;
$post_id = get_the_ID();
$lat = $wpdb->get_var("SELECT meta_value FROM wp_postmeta WHERE post_id = $post_id AND meta_key= '_wpgmp_metabox_latitude'");
$lng = $wpdb->get_var("SELECT meta_value FROM wp_postmeta WHERE post_id = $post_id AND meta_key= '_wpgmp_metabox_longitude'");
$ret .= getMap($lat,$lng);

function getMap($lat, $lng)
{
return '


function initFitterMap() {
var uluru = {lat: '.$lat.', lng: '.$lng.'};
var map = new google.maps.Map(document.getElementById('."'fittermap'".'), {
zoom: 11,
center: uluru,
});
var marker = new google.maps.Marker({
position: uluru,
map: map,
});
}
$(document).ready(function() {
initFitterMap();
});
';
}


I styled this custom map using the same js array I used for the main multi marker map.

If anyone reading this wants help achieving the same thing give me a shout @Aetherweb.
#2

Please login or Register to Submit Answer