Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
GravityView Maps - Override centering of a map
<?php
add_filter( 'gravityview/maps/render/options', 'gv_maps_render_options_override_center_usa' );
/**
* Centers a map on the continental United States
*
* @param array $options GravityView Maps options array
*
* @return array Map with "center" set to center of USA
*/
function gv_maps_render_options_override_center_usa( $options ) {
// Note that the key name is "lng", not "long"
$options['MapOptions']['center'] = array( 'lat' => 37.0902, 'lng' => - 95.7129 );
return $options;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.