File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @johnbillion/wp-hooks-generator" ,
3
3
"version" : " 0.8.0" ,
4
- "description" : " Scans the WordPress actions and filters in your code and saves them as JSON. " ,
4
+ "description" : " Generates a JSON representation of the WordPress actions and filters in your code" ,
5
5
"private" : true ,
6
6
"repository" : {
7
7
"type" : " git" ,
Original file line number Diff line number Diff line change 1
- # wp-hooks-generator
1
+ # WP Hooks Generator
2
2
3
3
Generates a JSON representation of the WordPress actions and filters in your code. Can be used with WordPress plugins, themes, and core.
4
4
@@ -14,14 +14,16 @@ composer require wp-hooks/generator
14
14
15
15
## Generating the Hook Files
16
16
17
- ./bin/wp-hooks-generator --input=src --output=hooks
17
+ ``` shell
18
+ ./bin/wp-hooks-generator --input=src --output=hooks
19
+ ```
18
20
19
21
## Usage of the Generated Hook Files in PHP
20
22
21
23
``` php
22
24
// Get hooks as JSON:
23
- $actions_json = file_get_contents( 'hook /actions.json' );
24
- $filters_json = file_get_contents( 'hook /filters.json' );
25
+ $actions_json = file_get_contents( 'hooks /actions.json' );
26
+ $filters_json = file_get_contents( 'hooks /filters.json' );
25
27
26
28
// Convert hooks to PHP:
27
29
$actions = json_decode( $actions_json, true )['hooks'];
You can’t perform that action at this time.
0 commit comments