added settings for map on post
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user