lesteph

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: Map centering not working in 2.73.16 #19427
    lesteph
    Participant

    Thanks – changing the format of the center value didn’t seem to fix it in 2.73.16 but upgrading to 2.73.17 does seem to have solved it.

    Could you update the documentation here at some point to help others, as this still shows center values being set using a lat/lng array?

    https://mappresspro.com/mappress-documentation/#toc-displaying-maps-using-php

    in 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.

    in reply to: Map centering not working in 2.73.16 #19421
    lesteph
    Participant

    Sure – here’s the production URL (rolled back to 2.73.12 so the map works OK):

    https://platinumjubilee.gov.uk/events/

    And on a test server (running 2.73.16), where map should be centred on UK lat/lng but isn’t:

    https://platinumjubilee-staging.pentri.com/events/

     

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