Add option to select Google Map type
This commit is contained in:
@@ -10,7 +10,8 @@
|
||||
var mapOptions = {
|
||||
scrollwheel: false,
|
||||
zoom: 12,
|
||||
center: ll
|
||||
center: ll,
|
||||
mapTypeId: google.maps.MapTypeId[vars.map_type]
|
||||
};
|
||||
var map = new google.maps.Map($self[0], mapOptions)
|
||||
var marker = new google.maps.Marker({
|
||||
|
||||
@@ -54,6 +54,19 @@ class SP_Settings_General extends SP_Settings_Page {
|
||||
'options' => $presets,
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Google Maps', 'sportspress' ),
|
||||
'id' => 'sportspress_map_type',
|
||||
'default' => 'ROADMAP',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'ROADMAP' => __( 'Default', 'sportspress' ),
|
||||
'SATELLITE' => __( 'Satellite', 'sportspress' ),
|
||||
'HYBRID' => __( 'Hybrid', 'sportspress' ),
|
||||
'TERRAIN' => __( 'Terrain', 'sportspress' ),
|
||||
),
|
||||
),
|
||||
|
||||
array( 'type' => 'sectionend', 'id' => 'general_options' ),
|
||||
|
||||
array( 'title' => __( 'Styles and Scripts', 'sportspress' ), 'type' => 'title', 'desc' => '', 'id' => 'script_styling_options' ),
|
||||
|
||||
@@ -50,6 +50,7 @@ class SP_Frontend_Scripts {
|
||||
if ( is_singular( 'sp_event' ) || is_tax( 'sp_venue' ) ):
|
||||
wp_enqueue_script( 'google-maps', 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false', array(), '3.exp', true );
|
||||
wp_enqueue_script( 'sp-maps', plugin_dir_url( SP_PLUGIN_FILE ) .'assets/js/sp-maps.js', array( 'jquery', 'google-maps' ), time(), true );
|
||||
wp_localize_script( 'sp-maps', 'vars', array( 'map_type' => strtoupper( get_option( 'sportspress_map_type', 'ROADMAP' ) ) ) );
|
||||
endif;
|
||||
|
||||
// Localize scripts.
|
||||
|
||||
Reference in New Issue
Block a user