You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -11,7 +11,7 @@ WordPress module developed for developers who want to quickly add WordPress hook
11
11
12
12
This documentation only covers the specific points of this library, if you want to know more about WordPress `action` or `filter`, the easiest is to look at [the documentation of WordPress](https://developer.wordpress.org/plugins/hooks/).
13
13
14
-
You can find all the documentation in [the wiki](https://github.com/dimitriBouteille/wp-module-hook/wiki).
14
+
You can find all the documentation in [the wiki](https://github.com/dimitriBouteille/wp-module-hook/wiki) or [here](#usage).
15
15
16
16
## Installation
17
17
@@ -36,6 +36,40 @@ In your PHP script, make sure you include the autoloader:
36
36
require __DIR__ . '/vendor/autoload.php';
37
37
~~~
38
38
39
+
## Usage
40
+
41
+
Before creating your first hook, you must initialize the module. It is advisable to add this code at the beginning of the `functions.php` file of your theme or in a `mu-plugin`.
42
+
43
+
```php
44
+
$loader = new \Dbout\Framework\Hook\HookLoader(
45
+
directory: get_template_directory() . '/hooks',
46
+
);
47
+
48
+
$loader->register();
49
+
```
50
+
51
+
Now you have initialized the module, you just need to create your first action in the hooks folder in your theme.
0 commit comments