-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.php
56 lines (46 loc) · 1.13 KB
/
init.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
<?php
/**
* Init
*
* @package NS_Customizer_Utilities
*/
namespace Nilambar\CustomizerUtils;
if ( defined( 'NSCU_VERSION' ) ) {
return;
}
if ( ! defined( 'NSCU_VERSION' ) ) {
define( 'NSCU_VERSION', '3.0.0' );
}
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
require_once __DIR__ . '/vendor/autoload.php';
}
if ( ! defined( 'NSCU_URL' ) ) {
define( 'NSCU_URL', rtrim( get_parent_theme_file_uri(), '/' ) . '/vendor/ernilambar/ns-customizer-utilities' );
}
if ( ! class_exists( Init::class, false ) ) :
/**
* Init class.
*
* @since 1.0.0
*/
class Init {
/**
* Constructor.
*
* @since 1.0.0
*/
public function __construct() {
add_action( 'customize_controls_enqueue_scripts', array( $this, 'load_assets' ), 0 );
}
/**
* Load assets.
*
* @since 1.0.0
*/
public function load_assets() {
wp_register_style( 'nscu-controls', NSCU_URL . '/assets/controls.css', array( 'wp-color-picker' ), NSCU_VERSION );
wp_register_script( 'nscu-controls', NSCU_URL . '/assets/controls.js', array( 'jquery', 'customize-controls', 'wp-color-picker' ), NSCU_VERSION, true );
}
}
new Init();
endif;