-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvc-gmaps-bg.php
75 lines (46 loc) · 1.59 KB
/
vc-gmaps-bg.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
<?php
/*
Plugin Name: VC GMaps Background Section
Plugin URI: http://www.visceralconcepts.com
Description: A shortcode to add the Google Map of the company's location to the bacground of any section.
Version: 1.16
Author: Visceral Concepts
Author URI: http://www.visceralconcepts.com
License: GPLv3 or Later
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
/*
Before the plugin does anything, we check for updates.
*/
require_once( 'inc/vc-plugin-updater.php' );
if ( is_admin() ) {
new VCMaps_Plugin_Updater( __FILE__, 'mmcnew', 'vc-gmaps-bg-plugin' );
}
//Load CSS & Scripts
add_action( 'wp_enqueue_scripts', 'gmaps_scripts', 16 );
function gmaps_scripts() {
wp_register_style( 'gmaps-css', plugin_dir_url(__FILE__) . 'css/gmaps-style.css' );
wp_register_script( 'gmaps-script', plugin_dir_url(__FILE__) . 'js/gmaps.js' );
wp_register_script( 'gmaps-api', 'https://maps.googleapis.com/maps/api/js?key=AIzaSyDChL8rujITiUSHZlRoxFIKRfydeZVUN10' );
wp_enqueue_style( 'gmaps-css' );
wp_enqueue_script( 'gmaps-api' );
wp_enqueue_script( 'gmaps-script' );
}
// Shortcode Construct
function bg_gmap( $atts ) {
$a = shortcode_atts ( array (
'pos' => '33.957194, -117.6135',
'color' => 'transparent',
'zoom' => '18'
), $atts );
return '<script type="text/javascript"> var position = [' . "{$a['pos']}" . ']; var zoomLvl = ' . $a['zoom'] . ';</script>
<div id="vcmap">
<div id="googlemaps"></div>
<div class="cover" style="background-color:' . "{$a['color']}" . ';"></div>
</div>';
}
add_shortcode( 'bgmap', 'bg_gmap' );
?>