Default Map Center on Home Page with Multi Location

This topic contains 5 replies, has 3 voices, and was last updated by  Kiran 5 years, 11 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket

Tagged: 

  • Author
    Posts
  • #456819

    Susan MacGregor
    Free User
    Post count: 2

    Hello,

    I have been reading a number of posts about setting a custom map center with multi location add-on for the home page, however have yet to find a suitable solution. I have tried adjusting the zoom level, and disabling “auto-zoom”.

    Is there a setting I am not finding in the WP admin interface where I can input a default lat/long? I need to adjust where the map centers on, for when users arrive at the home page.

    Alternatively, is there any code I can intercept with a custom plugin? If so, would it be possible to add a filter to a GeoDirectory function that sets the map center? If so, which function in which file?

    Thank you so much!

    #456822

    Alex Rollin
    Moderator
    Post count: 27815

    GD Maps always ‘center’ on the group of listings displayed on the map, so, there is no input for a lat lon to choose a center for the map.

    If you are using GDV1 there is an option to redirect users to the default location, but, can you say more about what you are trying to do? Do you want it centered on a particular city? GD creates pages for each city, and you should find that the city map for say London is then centered on London.

    #456823

    Susan MacGregor
    Free User
    Post count: 2

    Thank you for such a prompt reply!
    I have attached 2 screen pics to illustrate what I am trying to achieve.

    The first attachment is ‘how it looks’ and the second is ‘how I’d like it to look’.
    How do you recommend I achieve this?

    Thanks so much!

    #456827

    Alex Rollin
    Moderator
    Post count: 27815

    Hello,

    I see what you mean there. I am not sure about how to achieve it, though.

    I have flagged your question for the developers as there might be a way to offset, as it looks like you just want to nudge things to the right, maybe they can provide a workaround but as far as I know this is not possible.

    #456830

    Susan MacGregor
    Free User
    Post count: 2

    Thank you for flagging my query.
    I am open to working on a filter in a custom plugin. It would help me so much if the developers could let me know which function/method in which file in their plugin defines the center of the map.

    I look forward to hearing from them.
    Thank you Alex!

    #456996

    Kiran
    Moderator
    Post count: 7069

    Hello Susan,

    Map center calculated by Google map bounds function, so all markers covered on the map.

    You can use following code snippet to set own custom map center(Replace MAP_CANVAS_NAME to respective canvas name used).

    
    
    function gd_snippet_map_options_home_map( $args = array() ) { 
        $args['enable_marker_cluster_no_reposition'] = true; 	// Don't reposition after load
    	$args['autozoom'] = false; 								// Disable auto-zoom to set custom map center
    
    	$args['zoom'] = 2;										// Default zoom
    	$args['latitude'] = 48.858372;							// Default latitude
    	$args['longitude'] = 2.294481;							// Default longitude
     
    	return $args;
    }
    add_filter ('geodir_map_options_MAP_CANVAS_NAME', 'gd_snippet_map_options_home_map', 10, 1 ); // Replace MAP_CANVAS_NAME to respective canvas name used. Ex: geodir_map_v3_home_map

    Thanks,
    Kiran

Viewing 6 posts - 1 through 6 (of 6 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount