-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplugin.php
52 lines (44 loc) · 1.2 KB
/
plugin.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
<?php
/**
* Plugin Name: Hubspot by SVBK
* Plugin URI: https://github.com/silverbackstudio/wp-hubspot
* Description: Embed Hubspot Forms
* Author: Silverback Studio
* Author URI: https://www.silverbackstudio.it
* Version: 1.0.0
* License: GPL2+
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
*
* @package CGB
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Block Initializer.
*/
require_once plugin_dir_path( __FILE__ ) . 'src/init.php';
/**
* Enqueue scripts and styles.
*/
function svbk_hubspot_scripts() {
wp_enqueue_script(
'hubspot-forms-shell',
'//js.hsforms.net/forms/shell.js',
null,
false
);
wp_enqueue_script(
'svbk-hubspot',
plugins_url( '/dist/forms.min.js', __FILE__ ),
array( 'jquery', 'hubspot-forms-shell' ),
'1.4.4',
true
);
$theme_support = get_theme_support( 'hubspot-forms' );
if ( is_array($theme_support) && !empty( $theme_support[0] ) && !empty( $theme_support[0]['style'] ) ) {
wp_localize_script( 'svbk-hubspot', 'hubspotFormThemeCss', array(apply_filters( 'svbk_hubspot_form_theme_css', $theme_support[0]['style'])) );
}
}
add_action( 'wp_enqueue_scripts', 'svbk_hubspot_scripts' );