Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.