Created
August 31, 2019 20:50
-
-
Save zackkatz/cb1f52f563cb13fd7abe06b0553cdec2 to your computer and use it in GitHub Desktop.
GravityView Maps - Override centering of a map
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
<?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