@artemsemkin/wp-headers 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -105,25 +105,44 @@ Running `processMapping({ type: 'plugin', slug: 'flavor-core', entityDir: '/path
|
|
|
105
105
|
|
|
106
106
|
### TGM version patching
|
|
107
107
|
|
|
108
|
-
When a plugin's `package.json` includes `wp.plugin.loadPluginsFile`, the tool
|
|
108
|
+
WordPress themes commonly use TGMPA to register required plugins with minimum version constraints. When a plugin's `package.json` includes `wp.plugin.loadPluginsFile`, the tool finds the matching slug in the TGM PHP file and patches its version string.
|
|
109
|
+
|
|
110
|
+
Given this TGM registration file in your theme:
|
|
109
111
|
|
|
110
112
|
```php
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
113
|
+
<?php
|
|
114
|
+
|
|
115
|
+
add_action( 'tgmpa_register', 'flavor_tgm_register_required_plugins' );
|
|
116
|
+
function flavor_tgm_register_required_plugins() {
|
|
117
|
+
$plugins = array(
|
|
118
|
+
array(
|
|
119
|
+
'name' => 'Flavor Core',
|
|
120
|
+
'slug' => 'flavor-core',
|
|
121
|
+
'source' => esc_url( $core_plugin_url ),
|
|
122
|
+
'required' => true,
|
|
123
|
+
'version' => '1.0.0',
|
|
124
|
+
),
|
|
125
|
+
array(
|
|
126
|
+
'name' => 'Flavor Elementor',
|
|
127
|
+
'slug' => 'flavor-elementor',
|
|
128
|
+
'source' => esc_url( $elementor_plugin_url ),
|
|
129
|
+
'required' => true,
|
|
130
|
+
'version' => '1.0.0',
|
|
131
|
+
),
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
tgmpa( $plugins, $config );
|
|
135
|
+
}
|
|
118
136
|
```
|
|
119
137
|
|
|
120
|
-
|
|
138
|
+
When `flavor-core`'s `package.json` has `"version": "2.0.0"`, processing updates only the matching entry:
|
|
121
139
|
|
|
122
|
-
```
|
|
123
|
-
|
|
140
|
+
```diff
|
|
141
|
+
- 'version' => '1.0.0',
|
|
142
|
+
+ 'version' => '2.0.0',
|
|
124
143
|
```
|
|
125
144
|
|
|
126
|
-
Whitespace alignment, quote styles, and other entries are preserved.
|
|
145
|
+
Whitespace alignment, quote styles, nested function calls, and other plugin entries are preserved.
|
|
127
146
|
|
|
128
147
|
## Usage
|
|
129
148
|
|