Support » Fixing WordPress » Fixing a PHP snippet for Maps

  • Hey WP

    I have a broken snippet, and I have no idea how to fix. Maybe someone knows php…

    I am trying to display a custom Google Map. This is official code where I after days of G Map support have this working map url. It seems that this URL is not output into the browser. At least the URL is not there. Map should appear under txt Stores in the white box, so I am doing somth wrong. Others have this php working, why not here!?

    add_filter( 'wcfm_google_map_api_url', function( $api_url, $api_key ) {
    $api_url = 'https://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge%2CNew+York%2CNY&zoom=13&size=600x300&maptype=roadmap&markers=color%3Ared%7Clabel%3AC%7C40.718217%2C-73.998284&key=MY-API-KEY-GOES-HERE&map_id=90c65ed61ac072ab';
    return $api_url;
    }, 50, 2 );

    Note: The map does get output as such. So map is there and URL is ok.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • It doesn’t work with this hook. It expects a JavaScript file as output. But the URL you use is a static map. You should be able to embed it as an external image or via embed block.

    I don’t know why you are even trying to solve this with this hook. If you are concerned about any connection to the WCFM plugin, you should contact their support forum: https://wordpress.org/support/plugin/wc-multivendor-marketplace/

    Thread Starter hebhansen

    (@hebhansen)

    @threadi

    • thx….
    • Support did not answer for 3 years or more!
    • i already placed this q over-there

    this is what I try to do

    Static API key Im supposed to Enter is which one? I need API key, Map I’d for custom . If the URL above is not it, why does Google Maps give me this after a full week of chat support everyday.

    I’m aware this is the wrong forum

    i’m also aware someone in here knows exactly what I need to do…

    How do I call something JavaScript from Google Maps, that will work for the above code and includes Map ID so that I see a styled map on my site.

    I simply don’t see why this is not working

    Thread Starter hebhansen

    (@hebhansen)

    Maps can be set as Raster or Vector… Which one should it be?

    Google said Vector, but somehow I have a feeling it’s incorrect

    Thread Starter hebhansen

    (@hebhansen)

    This comes out empty – no map

    add_filter( 'wcfm_google_map_api_url', function( $api_url, $api_key ) {
    	$api_url = 'MY-VERY-SECRET-API-WITH-NO-RESTRICTIONS-AT-ALL-FOR-TESTING';
    	return $api_url;
    }, 50, 2 );

    And I don’t really see how it add my custom map, which is what I am trying to do….

    Google Maps suggested this:

    add_filter( 'wcfm_google_map_api_url', function( $api_url, $api_key ) {
    	$api_url = 'https://maps.googleapis.com/maps/api/js?key=MY-AWESOME-API-KEY&callback=initMap&v=weekly';
    	return $api_url;
    }, 50, 2 );

    How can this be so difficult?

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