-
Notifications
You must be signed in to change notification settings - Fork 0
/
class-24 (google-map) .php
77 lines (58 loc) · 3.07 KB
/
class-24 (google-map) .php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
// install contact form 7 plugin and edit
//---------------------------------------
1. download gamp from http://gmap3.net/quickstart.html
2. add this to js in plugin folder
3. add link to to stock-toolkit.php stock-toolkit-files function
wp_enqueue_script('gmap3', plugin_dir_url(__FILE__).'assets/js/gmap3.min.js',array('jquery'),'232323', true);
add this either
require_once(STOCK_ACC_PATH.'theme-shortcodes/styled-map-shortcode.php');
5. make styled-map-shortcode
///////////////////////// gentrate a api key
<?php
function stock_gmap_shortcode($atts, $content = null){
extract( shortcode_atts( array(
'title' => '',
), $atts) );
$stock_gmap_markup = '
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=
AIzaSyASRYEEysVX728251IBbxyTExJfh51tr8c®ion=US"></script>
<div style="width:100%;height:500px" class="map"></div>
<script>
JQuery(document).ready(function($){
$(".map")
.gmap3({
center:[41.850033, -87.650052],
zoom:12,
mapTypeId: "shadeOfGrey", // to select it directly
mapTypeControlOptions: {
mapTypeIds: [google.maps.MapTypeId.ROADMAP, "shadeOfGrey"]
}
})
.styledmaptype(
"shadeOfGrey",
[
{"featureType":"all","elementType":"labels.text.fill","stylers":[{"saturation":36},{"color":"#000000"},{"lightness":40}]},
{"featureType":"all","elementType":"labels.text.stroke","stylers":[{"visibility":"on"},{"color":"#000000"},{"lightness":16}]},
{"featureType":"all","elementType":"labels.icon","stylers":[{"visibility":"off"}]},
{"featureType":"administrative","elementType":"geometry.fill","stylers":[{"color":"#000000"},{"lightness":20}]},
{"featureType":"administrative","elementType":"geometry.stroke","stylers":[{"color":"#000000"},{"lightness":17},{"weight":1.2}]},
{"featureType":"landscape","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":20}]},
{"featureType":"poi","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":21}]},
{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#000000"},{"lightness":17}]},
{"featureType":"road.highway","elementType":"geometry.stroke","stylers":[{"color":"#000000"},{"lightness":29},{"weight":0.2}]},
{"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":18}]},
{"featureType":"road.local","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":16}]},
{"featureType":"transit","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":19}]},
{"featureType":"water","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":17}]}
],
{name: "Shades of Grey"}
);
});
</script>
';
return $stock_gmap_markup;
}
add_shortcode('stock_gmap_box', 'stock_gmap_shortcode');
6. make a map page and voila enable content from page options
?>