Use Google for GeoCoding and OpenStreetMaps for map displays
- Use OpenSteetMaps for frontend map displays
- Use Google Maps to add addresses to your database
Map settings
Go to GeoDirectory > Settings > General tab > General sub-tab > Show Advanced and add your Google APi keys, and set the Maps API to use OpenStreetMaps.
Add PHP code
Add the following PHP code (we recommend using the Code Snippets plugin)
/** * Load Google map on admin backend add or edit listing page. */ function gd_snippet_admin_add_listing_map_name( $map ) { global $post, $pagenow; if( ( 'edit.php' === $pagenow || 'post.php' === $pagenow || 'post-new.php' == $pagenow ) && ! empty( $post->post_type ) && geodir_is_gd_post_type( $post->post_type ) ) { $map = 'google'; // google or osm } return $map; } add_filter( 'geodir_map_name', 'gd_snippet_admin_add_listing_map_name', 20, 1 ); /** * Load Google map on frontend add or edit listing page. */ function gd_snippet_map_name( $map ) { if ( geodir_is_page( 'add-listing' ) ) { $map = 'google'; // google or osm } return $map; } add_filter( 'geodir_map_name', 'gd_snippet_map_name', 20, 1 );