Created
September 8, 2016 04:55
-
-
Save fcgist/260b3269d2d088a640658f170b87e15a to your computer and use it in GitHub Desktop.
Center a Google Map on the Current WordPress Post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('wpgmp_maps_options','wpgmp_maps_options',1,2); | |
function wpgmp_maps_options($default,$map_id) { | |
// Declare global $post to get current post data. | |
global $post; | |
// Get current post's latitude added by wp google map pro meta box. | |
$default[center_lat]= get_post_meta($post->ID,'_wpgmp_metabox_latitude'); | |
// Get current post's longitude added by wp google map pro meta box. | |
$default[center_lng]=get_post_meta($post->ID,'_wpgmp_metabox_longitude'); | |
//Return modified center location of the map. | |
return $default; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment