Skip to content

Instantly share code, notes, and snippets.

@luistinygod
Created September 2, 2015 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luistinygod/1beebb5ac356b1a16653 to your computer and use it in GitHub Desktop.
Save luistinygod/1beebb5ac356b1a16653 to your computer and use it in GitHub Desktop.
GravityView Maps Premium View: Specify the Latitude and Longitude form field IDs (to be used instead of the address field)
<?php
/**
* Use the cordinates (Latitude and Longitude) instead of the address to position the markers over the Maps
* Replace 'MY_LATITUDE_FIELD_ID' and 'MY_LONGITUDE_FIELD_ID' by the form field ids containing the latitude and longitude
* @param array $fields Gravity Forms fields IDs containing the latitude and longitude
* @param GravityView_View object $view Current View object
*/
function my_gv_maps_lat_long_fields( $fields, $view ) {
return array( 'MY_LATITUDE_FIELD_ID', 'MY_LONGITUDE_FIELD_ID' );
}
add_filter( 'gravityview/maps/markers/lat_long/fields_id’, ‘my_gv_maps_lat_long_fields’, 10, 2 );
@rafaehlers
Copy link

correcting the single quotes: add_filter( 'gravityview/maps/markers/lat_long/fields_id', 'my_gv_maps_lat_long_fields', 10, 2 );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment