Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zackkatz/630da145c8c813a48ba3b282b3610e5a to your computer and use it in GitHub Desktop.
Save zackkatz/630da145c8c813a48ba3b282b3610e5a to your computer and use it in GitHub Desktop.
GravityView Maps - How to define the map's "zoom control" position
<?php
/**
* Set the Zoom control position
*
* @param array $map_settings
*
* @return array
*/
function gravityview_maps_modify_zoom_position( $map_settings = array() ) {
// Only set the position if forcing zoom display. If you letting Google decide (NULL value), you can't set the control position
if( true === rgars( $map_settings, 'MapOptions/zoomControl' ) ) {
// Options include: BOTTOM_CENTER, BOTTOM_LEFT, BOTTOM_RIGHT, LEFT_BOTTOM, LEFT_CENTER, LEFT_TOP, RIGHT_BOTTOM, RIGHT_CENTER, RIGHT_TOP, TOP_CENTER, TOP_LEFT, TOP_RIGHT
$map_settings['MapOptions']['zoomControlOptions'] = array(
'position' => 'TOP_RIGHT'
);
}
return $map_settings;
}
add_filter( 'gravityview/maps/render/options', 'gravityview_maps_modify_zoom_position' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment