Skip to content

Instantly share code, notes, and snippets.

@zackkatz
Created August 31, 2019 20:50
Show Gist options
  • Save zackkatz/cb1f52f563cb13fd7abe06b0553cdec2 to your computer and use it in GitHub Desktop.
Save zackkatz/cb1f52f563cb13fd7abe06b0553cdec2 to your computer and use it in GitHub Desktop.
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