Use Google Maps on backend and display Open Street Maps in Template

Support General Use Google Maps on backend and display Open Street Maps in TemplateResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #34686
    shmaltzshmaltz
    Participant

    Hi!

    Is it possible to use the Google Maps field on the backend (because it gives me better info than OSM) and then use Open Street Maps on the frontend to display the map?

    I want to use OSM on the frontend because I don't want to have to pay for every page load.

    Thanks!

    #35189
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Yes, it is possible. Field Google Maps and OSM save the same data format in the database so we can display the OSM on the frontend based on the value of the Google Maps field. Here is the sample code

    $location = rwmb_get_value( 'google_map' );
    $map = implode( ',', $location );
    
    echo RWMB_OSM_Field::render_map( $map );

    Read more on the documentation https://docs.metabox.io/fields/osm/#template-usage

    #35219
    shmaltzshmaltz
    Participant

    That worked perfectly. Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.