Reply To: Map centering not working in 2.73.16

Home Forums MapPress Support Map centering not working in 2.73.16 Reply To: Map centering not working in 2.73.16

#19424
lesteph
Participant

In a custom page template:

$mymap = new Mappress_Map([
"width" => "100%",
"height" => "700",
"center" => ["lat" => 54.5,"lng" => -4.5],
"zoom" => 6,
"poiList" => false,
]);

various loops to add POIs to an array ($loc_array is a geocoded array of lat/lng per POI):

$mypoi_tmp = new Mappress_Poi(array(
"title" => esc_attr(get_the_title()),
"body" => "<p class='meta'>".esc_attr(wp_trim_words(get_the_excerpt(),30))."</p><p>More details</p>",
"point" => $loc_array,
));

...

$mypois[] = $mypoi_tmp;

then rendered using:

$mymap->pois = $mypois;
echo $mymap->display(array("directions"=>"none"));

I wondered if there might be a problem with a POI (as I have hundreds) causing some kind of hidden JS error but even rendering the map with no POIs, setting center/zoom is still ignored.