How can I use Google for GeoCoding and OpenStreetMaps for map displays in WordPress?


**
 * Load Google map on admin backend add or edit listing page.
 */
function wpsc_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', 'wpsc_gd_snippet_admin_add_listing_map_name', 20, 1 );
/**
 * Load Google map on frontend add or edit listing page.
 */
function wpsc_gd_snippet_map_name( $map ) {
    if ( geodir_is_page( 'add-listing' ) ) {
        $map = 'google'; // google or osm
    }
    return $map;
}
add_filter( 'geodir_map_name', 'wpsc_gd_snippet_map_name', 20, 1 );

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!

Share This