• Resolved Marc Lacroix

    (@marcusig)


    Hi,
    First, thanks for the plugin!
    I’m not really asking for support, but sharing a trick I use to make the map responsive for a website I’m building:

    Add this to functions.php in a (child) theme or plugin:

    add_filter( 'bgmp_clean-map-shortcode-arguments-return', 'overide_BGMP_arguments', 100 );
    
    function overide_BGMP_arguments( $params ) {
    
    	if( $params['mapWidth'] == '100' ) {
    		$params['mapWidth'] = "100%";
    	}
    	return $params;
    }

    Then when you insert a map, choose ‘100’ for the width.
    Voilà.

    https://wordpress.org/plugins/basic-google-maps-placemarks/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi Marcusig,

    Thanks for the recommendation!

    I am new to WordPress and I am using the insert php plugin and this is what I inserted on my page for the map but it does not work:
    (it creates a second box below the map)

    [bgmp-map]
    [insert_php]
    add_filter( ‘bgmp_clean-map-shortcode-arguments-return’, ‘overide_BGMP_arguments’, 100 );

    function overide_BGMP_arguments( $params ) {

    if( $params[‘mapWidth’] == ‘100’ ) {
    $params[‘mapWidth’] = “100%”;
    }
    return $params;
    }
    [/insert_php]

    Do you have any advice to apply your trick in this context ?

    Thanks,

    Thread Starter Marc Lacroix

    (@marcusig)

    Hi clemrov,

    Try inserting the [bgmp-map] shortcode after the [insert_php] one, as the php has to be executed first.
    And if it doesn’t work, you’ll probably have to put the php in your theme’s Functions.php file or in a plugin.
    (If you use a third party theme, I strongly recommend making a child theme to make this sort of changes), or making a quick plugin — is you can).
    Also your [bgmp-map] must have 100 set for its width. So either in the plugin’s settings, eiher passed as an argument: [bgmp-map width=”100″]

    I included it in the child theme and now it works 🙂
    Thanks a lot!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘[Hook] Making map Responsive’ is closed to new replies.