1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* The public-facing functionality of the plugin. |
4
|
|
|
* |
5
|
|
|
* @link https://github.com/maab16 |
6
|
|
|
* @since 1.0.0 |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* The public-facing functionality of the plugin. |
11
|
|
|
* |
12
|
|
|
* Defines the plugin name, version, and two examples hooks for how to |
13
|
|
|
* enqueue the public-facing stylesheet and JavaScript. |
14
|
|
|
* |
15
|
|
|
* @author Md Abu Ahsan basir <[email protected]> |
16
|
|
|
*/ |
17
|
|
|
class WPB_Public |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* The ID of this plugin. |
21
|
|
|
* |
22
|
|
|
* @since 1.0.0 |
23
|
|
|
* |
24
|
|
|
* @var string The ID of this plugin. |
25
|
|
|
*/ |
26
|
|
|
private $plugin_name; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* The version of this plugin. |
30
|
|
|
* |
31
|
|
|
* @since 1.0.0 |
32
|
|
|
* |
33
|
|
|
* @var string The current version of this plugin. |
34
|
|
|
*/ |
35
|
|
|
private $version; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Initialize the class and set its properties. |
39
|
|
|
* |
40
|
|
|
* @since 1.0.0 |
41
|
|
|
* |
42
|
|
|
* @param string $plugin_name The name of the plugin. |
43
|
|
|
* @param string $version The version of this plugin. |
44
|
|
|
*/ |
45
|
|
|
public function __construct($plugin_name, $version) |
46
|
|
|
{ |
47
|
|
|
$this->plugin_name = $plugin_name; |
48
|
|
|
$this->version = $version; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Register the stylesheets for the public-facing side of the site. |
53
|
|
|
* |
54
|
|
|
* @since 1.0.0 |
55
|
|
|
*/ |
56
|
|
|
public function enqueue_styles() |
57
|
|
|
{ |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* This function is provided for demonstration purposes only. |
61
|
|
|
* |
62
|
|
|
* An instance of this class should be passed to the run() function |
63
|
|
|
* defined in WPB_Loader as all of the hooks are defined |
64
|
|
|
* in that particular class. |
65
|
|
|
* |
66
|
|
|
* The WPB_Loader will then create the relationship |
67
|
|
|
* between the defined hooks and the functions defined in this |
68
|
|
|
* class. |
69
|
|
|
*/ |
70
|
|
|
wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/wpb-public.css', [], $this->version, 'all'); |
|
|
|
|
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Register the JavaScript for the public-facing side of the site. |
75
|
|
|
* |
76
|
|
|
* @since 1.0.0 |
77
|
|
|
*/ |
78
|
|
|
public function enqueue_scripts() |
79
|
|
|
{ |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* This function is provided for demonstration purposes only. |
83
|
|
|
* |
84
|
|
|
* An instance of this class should be passed to the run() function |
85
|
|
|
* defined in WPB_Loader as all of the hooks are defined |
86
|
|
|
* in that particular class. |
87
|
|
|
* |
88
|
|
|
* The WPB_Loader will then create the relationship |
89
|
|
|
* between the defined hooks and the functions defined in this |
90
|
|
|
* class. |
91
|
|
|
*/ |
92
|
|
|
wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__).'js/wpb-public.js', ['jquery'], $this->version, false); |
|
|
|
|
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
|