added settings for map on post

This commit is contained in:
lenovo
2022-11-13 19:26:11 +01:00
parent ada87da370
commit 5596c5e954
7 changed files with 66 additions and 10 deletions

View File

@@ -32,9 +32,38 @@ require_once(dirname(__FILE__) . '/mp_address_errors.php');
require_once(dirname(__FILE__) . '/mp_create_div.php');
// // temp test
//
// add_action( 'wp', 'my_front_end_function');
// function my_front_end_function() {
// if ( is_admin() )
// return;
// if ( get_post_type() != "post" )
// return;
// if ( get_post_status() != "publish" )
// return;
//
// $location = get_field(location);
// mp_console_log("location:");
// mp_console_log($location);
//
// $coordinates = $location->coordinates;
// mp_console_log("coordinates:");
// mp_console_log($coordinates);
// }
function is_event_post() {
if ( is_admin() )
return false;
if ( get_post_type() != "post" )
return 0;
if ( get_post_status() != "publish" )
return 0;
return true;
}
/**
@@ -89,6 +118,18 @@ function mp_ljdp_map() {
"locations" => $locations,
"filters" => $filters,
);
// if post event instead of map page, change ccoordinate and zoom
global $mp_zoom;
if (is_event_post()) {
$mp_zoom = $mp_zoom_set[1];
$location = get_field(location);
$coordinates = $location->coordinates;
$mp_coordinates_default = $coordinates;
}
mp_add_to_scripts($to_add);