• Resolved biels

    (@biels)


    I have a ACF google maps address field but I see this when I try to display it in a FSE template:

    This data type is not supported! Please contact the author for help.

    Is it possible to display it with the pro version?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Phi Phan

    (@mr2p)

    Hello @biels,

    At the moment, MFB both the free and Pro versions doesn’t support displaying the ACF Google Map field. I do plan to add support for it in the Pro version in the future.

    Best, Phi.

    Thread Starter biels

    (@biels)

    Thanks for the quick reply! I’ll convert the field to plain text for now. Looking forward to any updates, thanks!

    Plugin Author Phi Phan

    (@mr2p)

    I’ll keep you posted once the Google Map field support is added. Thanks for your understanding!

    Plugin Author Phi Phan

    (@mr2p)

    Hi @biels,

    I’ve just added support for the ACF Google Map field in the PRO version. It’s now available in the beta release 1.4.6-beta.0.

    Here are a few notes about the Google Map field.

    API Key
    By default, MFB retrieves the API key from acf_get_setting( 'google_api_key' ). If you add the key using acf_update_setting( 'google_api_key', 'xxx' ), MFB will automatically detect it. If you’re not adding the key this way, you can use this filter instead:

    add_filter( 'acf/settings/google_api_key', fn( $key ) => 'your_key_here' );

    Map height
    The height of the map canvas is based on the height setting of your ACF Google Map field.

    Editor preview
    MFB doesn’t render the map preview inside the editor. It will show an empty canvas there instead.

    Frontend display
    On the frontend, the map will display a default marker at its center, with the address shown in an info window.

    How to customize the map?

    Add multiple markers
    To display multiple markers, create a repeater field with map, title, and description subfields. Then use this sample code:

    add_filter(
    'meta_field_block_google_map_markers',
    function( $markers, $raw_value, $field, $post_id, $object_type ) {
    $maps = get_field( 'maps_repeater', $post_id );
    if ( $maps ) {
    foreach ( $maps as $map ) {
    $markers[] = [
    'lat' => $map['map']['lat'],
    'lng' => $map['map']['lng'],
    'info' => '<h3>' . esc_html( $map['title'] ) . '</h3><p>' . esc_html( $map['description'] ) . '</p>',
    ];
    }
    }
    return $markers;
    },
    10,
    5
    );

    Change the marker icon or map styles
    Use the following filter to modify the marker image or map styling:

    add_filter(
    'meta_field_block_google_map_settings',
    fn( $settings ) => [
    'marker' => 'https://url_to_custom_image/pin.png',
    'styles' => [
    [
    'featureType' => 'all',
    'elementType' => 'geometry.fill',
    'stylers' => [ [ 'weight' => '2.00' ] ],
    ],
    // ... your custom styles here ...
    ],
    ]
    );

    I recommend getting your map styles from Snazzy Maps.
    Just remember to convert the JSON to PHP array format , ChatGPT can do this quickly for you.

    Please let me know if you have any questions or need help with the setup.

    Best, Phi.

    Plugin Author Phi Phan

    (@mr2p)

    Here’s a video guide for anyone who wants to display an ACF Google Map field:

    How to display an ACF Google Map field with Meta Field Block Pro
Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.