File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ console . log ( "Start the engine!" ) ;
Original file line number Diff line number Diff line change 8
8
*
9
9
* @package wp-js-plugin-starter
10
10
*/
11
+
12
+ /**
13
+ * Retrieves a URL to a file in the plugin's directory.
14
+ *
15
+ * @param string $path Relative path of the desired file.
16
+ *
17
+ * @return string Fully qualified URL pointing to the desired file.
18
+ *
19
+ * @since 1.0.0
20
+ */
21
+ function wp_js_plugin_starter_url ( $ path ) {
22
+ return plugins_url ( $ path , __FILE__ );
23
+ }
24
+
25
+ /**
26
+ * Registers the plugin's script.
27
+ *
28
+ * @since 1.0.0
29
+ */
30
+ function wp_js_plugin_starter_register_script () {
31
+ wp_register_script (
32
+ 'wp-js-plugin-starter ' ,
33
+ wp_js_plugin_starter_url ( 'src/index.js ' ),
34
+ array ()
35
+ );
36
+ }
37
+
38
+ /**
39
+ * Enqueues the plugin's script.
40
+ *
41
+ * @since 1.0.0
42
+ */
43
+ function wp_js_plugin_starter_enqueue_script () {
44
+ wp_enqueue_script ( 'wp-js-plugin-starter ' );
45
+ }
46
+
47
+ /**
48
+ * Trigger the script registration on init.
49
+ */
50
+ add_action ( 'init ' , 'wp_js_plugin_starter_register_script ' );
51
+
52
+ /**
53
+ * Enqueue the script in all admin pages
54
+ */
55
+ add_action ( 'admin_enqueue_scripts ' , 'wp_js_plugin_starter_enqueue_script ' );
You can’t perform that action at this time.
0 commit comments