Remove "Map,Satellite and Street view" from Map
This topic contains 15 replies, has 4 voices, and was last updated by Kiran 5 years, 7 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
August 5, 2019 at 1:55 pm #501386
Is there a way to turn off “Map,Satellite and Street view” from map view?
I have found a thread in the forum from 2015, my guess that doesn’t apply since I’m on V2.
August 5, 2019 at 3:50 pm #501412Do you mean when viewing the map on the frontend? As in, disable the map controls?
We have a snippet for streetview. I will flag your question for the developers to see if there is also an additional parameter for the map layer control.
https://wpgeodirectory.com/support/topic/disable-scrollwheel-on-gd_add_listing-page-map/#post-500083
August 5, 2019 at 11:42 pm #501486Hi Alex,
Yes, i would like to remove option to remove Map & Satellite and street view.it would be nice to have toggle switches under Geo-directory>Settings>Map Styles to turn on/off map options for site admins.
Snippet it works for add listing page can it be modified to disable controls on map on the frontend.August 6, 2019 at 8:23 am #501544Hi
Thanks for your reply. Could you try using the method here https://wpgeodirectory.com/support/topic/remove-mapsatellite-from-home-page-map/#post-46387 and see if it helps?
August 6, 2019 at 8:26 pm #501669Nope, it did not work, but I’m not sure if it is not working because of an differences between V1 and V2.
August 6, 2019 at 9:30 pm #501682You added this snippet? https://gist.github.com/Stiofan/2ddaebd31553f476bc59
I have flagged your topic for the developers to give a hint about how this works for V2
/** * Filter the add listing map arguments. */ function gd_snippet_190729_template_render_map_js_params() { $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : NULL; $screen_id = $screen ? $screen->id : ''; if ( ! ( $screen_id && geodir_is_gd_post_type( $screen_id ) || geodir_is_page( 'add-listing' ) ) ) { return; } $params = array(); //$params[] = "maptype: 'ROADMAP'"; // Map type (ex: HYBRID, ROADMAP, SATELLITE, TERRAIN) //$params[] = "zoom: 10"; // Default zoom (ex: 12). //$params[] = "scrollwheel: false"; // Mouse scroll (ex: true or false). //$params[] = "streetViewControl: false"; // Street view control (ex: true or false). $params[] = "mapTypeControl: false"; // Map Type Control (ex: true or false). if ( ! empty( $params ) ) { echo implode( ',', $params ) . ','; } } add_filter( 'geodir_template_render_map_js_params', 'gd_snippet_190729_template_render_map_js_params' , 20, 1 );
Try adding that as a code snippet; let us know how it goes.
August 7, 2019 at 2:19 pm #501814It works on Add listing page. How do I apply it to home page or all pages?
ThanksAugust 9, 2019 at 12:55 pm #502296Hi Alex, can this snippet be applied to home page or all pages?
August 9, 2019 at 5:00 pm #502340To make the changes on every page try
/** * Filter the add listing map arguments. */ function gd_snippet_19072329_template_render_map_js_params() { $params = array(); //$params[] = "maptype: 'ROADMAP'"; // Map type (ex: HYBRID, ROADMAP, SATELLITE, TERRAIN) //$params[] = "zoom: 10"; // Default zoom (ex: 12). //$params[] = "scrollwheel: false"; // Mouse scroll (ex: true or false). //$params[] = "streetViewControl: false"; // Street view control (ex: true or false). $params[] = "mapTypeControl: false"; // Map Type Control (ex: true or false). if ( ! empty( $params ) ) { echo implode( ',', $params ) . ','; } } add_filter( 'geodir_template_render_map_js_params', 'gd_snippet_19072329_template_render_map_js_params' , 20, 1 );
*edit* changed function num
August 9, 2019 at 8:54 pm #502392I tried new code in snippet, it only works on Add-Listing page, no affect on home page or any other page.
August 9, 2019 at 9:03 pm #502394Edited, try it now (you wouldn’t need the first one with the second one installed.)
August 10, 2019 at 2:53 pm #502472This reply has been marked as private.August 10, 2019 at 8:40 pm #502489Thanks, the developers will take a look.
August 14, 2019 at 5:47 am #502995Hello tradingbasics,
I have added following PHP snippet to disable Map Type and Street View controls from Google maps on archive & detail page maps. Snippet that you already added is works only for add listing map.
/** * Remove Map Type and Street View controls from Google maps. */ function gd_snippet_190814_map_params( $params, $map_args ) { $map_type = $params['map_type']; $map_canvas = $params['map_canvas']; //if ( $map_canvas == 'gd_map_canvas_directory' ) { $params['mapTypeControl'] = false; // Map Type control $params['streetViewControl'] = false; // Street View control //} return $params; } add_filter( 'geodir_map_params', 'gd_snippet_190814_map_params', 20, 2 );
Regards,
KiranAugust 14, 2019 at 1:14 pm #503058Kiran & Alex, Thank you for your support.
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket