Googlemap field not working in view

Support MB Views Googlemap field not working in view

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #37027
    Chris PChris P
    Participant

    Hi,

    In the backend the maps works just fine. But in the front I get errors that say I'm not using a key. Which I am so what am I doing wrong.

    API key is okay (exists, billable and no restrictions)

    But still I keep getting this

    You are using this API without a key. See https://developers.google.com/maps/documentation/javascript/error-messages?…aps_js&utm_medium=degraded&utm_campaign=billing#api-key-and-billing-errors

    #37035
    Marius DokoMarius Doko
    Participant

    Hello,

    I am also having issues on View, but not with google maps but with OSM. Since the last update, i can't see the map in the frontend. In backend works well

    #37045
    Long NguyenLong Nguyen
    Moderator

    Hi,


    @Chris
    : Is the Google map a subfield (in a group) on your site? Please share some screenshots of the issue and the code that creates the custom fields.

    @Marius: Please use the option Map (custom style) when inserting the field map to View content. The option default style does not look working.

    #37298
    Chris PChris P
    Participant

    Hi Long,

    Yes it's the map is a subfield of the address group

    This is the map {{ mb.render_map( post.office_address.map_google ) }}

    In the backend it displays in the frontend it's an empty space

    #37301
    Chris PChris P
    Participant

    UPDATE

    ok these do not work:

    {{ mb.render_map( post.office_address.map_google ) }}
    
    {{ mb.rwmb_meta( 'post.office_address.map_google') }}

    This does work

    in functions.php

    function my_map() {
        $group_values = rwmb_meta( 'office_address' );
        $args = array(
            'api_key' => 'GOOGLE API CODE'
        );
        echo RWMB_Map_Field::render_map( $group_values['map_google'], $args );
    }

    in view
    {{ mb.my_map() }}

    #38763
    Chris PChris P
    Participant

    Hi after updating,

    My solution doesn't work anymore. But the standard map still doesn't work

    I get the following error
    ReferenceError: google is not defined

    In the backend everything works fine in the front nothing shows up

    I use {{ post.office_address.map_google.rendered }} to display it

    Br,
    Chris

    #38769
    Long NguyenLong Nguyen
    Moderator

    Hi,

    If you want to output the subfield Google map in a group, you need to pass the API key to the function render_map() as on the documentation https://docs.metabox.io/fields/map/#outputting-a-map-in-a-group

    In your case, google is not defined, I think there is another JS error and it breaks all JS functions on your site. You can try to deactivate all plugins except Meta Box, MB extensions, switch to the standard theme of WordPress and recheck this issue.

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