@mytechtoday/augment-extensions 0.1.1 → 0.2.0
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/augment-extensions/domain-rules/wordpress/README.md +163 -0
- package/augment-extensions/domain-rules/wordpress/module.json +32 -0
- package/augment-extensions/domain-rules/wordpress/rules/coding-standards.md +617 -0
- package/augment-extensions/domain-rules/wordpress/rules/directory-structure.md +270 -0
- package/augment-extensions/domain-rules/wordpress/rules/file-patterns.md +423 -0
- package/augment-extensions/domain-rules/wordpress/rules/gutenberg-blocks.md +493 -0
- package/augment-extensions/domain-rules/wordpress/rules/performance.md +568 -0
- package/augment-extensions/domain-rules/wordpress/rules/plugin-development.md +510 -0
- package/augment-extensions/domain-rules/wordpress/rules/project-detection.md +251 -0
- package/augment-extensions/domain-rules/wordpress/rules/rest-api.md +501 -0
- package/augment-extensions/domain-rules/wordpress/rules/security.md +564 -0
- package/augment-extensions/domain-rules/wordpress/rules/theme-development.md +388 -0
- package/augment-extensions/domain-rules/wordpress/rules/woocommerce.md +441 -0
- package/augment-extensions/domain-rules/wordpress-plugin/README.md +139 -0
- package/augment-extensions/domain-rules/wordpress-plugin/examples/ajax-plugin.md +1599 -0
- package/augment-extensions/domain-rules/wordpress-plugin/examples/custom-post-type-plugin.md +1727 -0
- package/augment-extensions/domain-rules/wordpress-plugin/examples/gutenberg-block-plugin.md +428 -0
- package/augment-extensions/domain-rules/wordpress-plugin/examples/gutenberg-block.md +422 -0
- package/augment-extensions/domain-rules/wordpress-plugin/examples/mvc-plugin.md +1623 -0
- package/augment-extensions/domain-rules/wordpress-plugin/examples/object-oriented-plugin.md +1343 -0
- package/augment-extensions/domain-rules/wordpress-plugin/examples/rest-endpoint.md +734 -0
- package/augment-extensions/domain-rules/wordpress-plugin/examples/settings-page-plugin.md +1350 -0
- package/augment-extensions/domain-rules/wordpress-plugin/examples/simple-procedural-plugin.md +503 -0
- package/augment-extensions/domain-rules/wordpress-plugin/examples/singleton-plugin.md +971 -0
- package/augment-extensions/domain-rules/wordpress-plugin/module.json +53 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/activation-hooks.md +770 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/admin-interface.md +874 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/ajax-handlers.md +629 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/asset-management.md +559 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/context-providers.md +709 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/cron-jobs.md +736 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/database-management.md +1057 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/documentation-standards.md +463 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/frontend-functionality.md +478 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/gutenberg-blocks.md +818 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/internationalization.md +416 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/migration.md +667 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/performance-optimization.md +878 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/plugin-architecture.md +693 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/plugin-structure.md +352 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/rest-api.md +818 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/scaffolding-workflow.md +624 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/security-best-practices.md +866 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/testing-patterns.md +1165 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/testing.md +414 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/vscode-integration.md +751 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/woocommerce-integration.md +949 -0
- package/augment-extensions/domain-rules/wordpress-plugin/rules/wordpress-org-submission.md +458 -0
- package/augment-extensions/examples/gutenberg-block-plugin/README.md +101 -0
- package/augment-extensions/examples/gutenberg-block-plugin/examples/testimonial-block.md +428 -0
- package/augment-extensions/examples/gutenberg-block-plugin/module.json +40 -0
- package/augment-extensions/examples/rest-api-plugin/README.md +98 -0
- package/augment-extensions/examples/rest-api-plugin/examples/task-manager-api.md +1299 -0
- package/augment-extensions/examples/rest-api-plugin/module.json +40 -0
- package/augment-extensions/examples/woocommerce-extension/README.md +98 -0
- package/augment-extensions/examples/woocommerce-extension/examples/product-customizer.md +763 -0
- package/augment-extensions/examples/woocommerce-extension/module.json +40 -0
- package/augment-extensions/workflows/wordpress-plugin/README.md +232 -0
- package/augment-extensions/workflows/wordpress-plugin/ai-prompts.md +839 -0
- package/augment-extensions/workflows/wordpress-plugin/bead-decomposition-patterns.md +854 -0
- package/augment-extensions/workflows/wordpress-plugin/examples/complete-plugin-example.md +540 -0
- package/augment-extensions/workflows/wordpress-plugin/examples/custom-post-type-example.md +1083 -0
- package/augment-extensions/workflows/wordpress-plugin/examples/feature-addition-workflow.md +669 -0
- package/augment-extensions/workflows/wordpress-plugin/examples/plugin-creation-workflow.md +597 -0
- package/augment-extensions/workflows/wordpress-plugin/examples/secure-form-handler-example.md +925 -0
- package/augment-extensions/workflows/wordpress-plugin/examples/security-audit-workflow.md +752 -0
- package/augment-extensions/workflows/wordpress-plugin/examples/wordpress-org-submission-workflow.md +773 -0
- package/augment-extensions/workflows/wordpress-plugin/module.json +49 -0
- package/augment-extensions/workflows/wordpress-plugin/rules/best-practices.md +942 -0
- package/augment-extensions/workflows/wordpress-plugin/rules/development-workflow.md +702 -0
- package/augment-extensions/workflows/wordpress-plugin/rules/submission-workflow.md +728 -0
- package/augment-extensions/workflows/wordpress-plugin/rules/testing-workflow.md +775 -0
- package/cli/dist/cli.js +5 -1
- package/cli/dist/cli.js.map +1 -1
- package/cli/dist/commands/show.d.ts.map +1 -1
- package/cli/dist/commands/show.js +41 -0
- package/cli/dist/commands/show.js.map +1 -1
- package/modules.md +52 -0
- package/package.json +1 -1
|
@@ -0,0 +1,624 @@
|
|
|
1
|
+
# WordPress Plugin Scaffolding Workflow
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This document provides workflows for scaffolding WordPress plugins using WP-CLI and manual methods. It covers plugin generation, file structure creation, and initial setup for different plugin complexity levels.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## WP-CLI Scaffolding (Recommended)
|
|
10
|
+
|
|
11
|
+
### Prerequisites
|
|
12
|
+
|
|
13
|
+
Install WP-CLI:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# macOS/Linux
|
|
17
|
+
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
|
18
|
+
chmod +x wp-cli.phar
|
|
19
|
+
sudo mv wp-cli.phar /usr/local/bin/wp
|
|
20
|
+
|
|
21
|
+
# Windows (via Composer)
|
|
22
|
+
composer global require wp-cli/wp-cli-bundle
|
|
23
|
+
|
|
24
|
+
# Verify installation
|
|
25
|
+
wp --info
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Basic Plugin Scaffold
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Navigate to WordPress plugins directory
|
|
32
|
+
cd /path/to/wordpress/wp-content/plugins
|
|
33
|
+
|
|
34
|
+
# Generate basic plugin
|
|
35
|
+
wp scaffold plugin my-plugin \
|
|
36
|
+
--plugin_name="My Plugin" \
|
|
37
|
+
--plugin_description="Brief description of my plugin" \
|
|
38
|
+
--plugin_author="Your Name" \
|
|
39
|
+
--plugin_author_uri="https://example.com" \
|
|
40
|
+
--plugin_uri="https://example.com/my-plugin" \
|
|
41
|
+
--skip-tests
|
|
42
|
+
|
|
43
|
+
# Navigate to plugin directory
|
|
44
|
+
cd my-plugin
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Generated structure:**
|
|
48
|
+
```
|
|
49
|
+
my-plugin/
|
|
50
|
+
├── my-plugin.php
|
|
51
|
+
├── readme.txt
|
|
52
|
+
├── .gitignore
|
|
53
|
+
└── package.json
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Plugin with Tests
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
wp scaffold plugin my-plugin \
|
|
60
|
+
--plugin_name="My Plugin" \
|
|
61
|
+
--plugin_description="Brief description" \
|
|
62
|
+
--plugin_author="Your Name" \
|
|
63
|
+
--activate
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Generated structure:**
|
|
67
|
+
```
|
|
68
|
+
my-plugin/
|
|
69
|
+
├── my-plugin.php
|
|
70
|
+
├── readme.txt
|
|
71
|
+
├── .gitignore
|
|
72
|
+
├── package.json
|
|
73
|
+
├── phpunit.xml.dist
|
|
74
|
+
├── bin/
|
|
75
|
+
│ └── install-wp-tests.sh
|
|
76
|
+
└── tests/
|
|
77
|
+
├── bootstrap.php
|
|
78
|
+
└── test-sample.php
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Advanced Scaffold with Custom Post Type
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Generate plugin
|
|
85
|
+
wp scaffold plugin my-plugin
|
|
86
|
+
|
|
87
|
+
# Navigate to plugin
|
|
88
|
+
cd my-plugin
|
|
89
|
+
|
|
90
|
+
# Add custom post type
|
|
91
|
+
wp scaffold post-type book \
|
|
92
|
+
--label=Books \
|
|
93
|
+
--textdomain=my-plugin \
|
|
94
|
+
--dashicon=book \
|
|
95
|
+
--plugin=my-plugin
|
|
96
|
+
|
|
97
|
+
# Add custom taxonomy
|
|
98
|
+
wp scaffold taxonomy genre \
|
|
99
|
+
--post_types=book \
|
|
100
|
+
--label=Genres \
|
|
101
|
+
--plugin=my-plugin
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Scaffold Plugin Block
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Generate Gutenberg block
|
|
108
|
+
wp scaffold block my-block \
|
|
109
|
+
--title="My Block" \
|
|
110
|
+
--plugin=my-plugin \
|
|
111
|
+
--namespace=my-plugin
|
|
112
|
+
|
|
113
|
+
# Generate dynamic block
|
|
114
|
+
wp scaffold block my-dynamic-block \
|
|
115
|
+
--title="My Dynamic Block" \
|
|
116
|
+
--plugin=my-plugin \
|
|
117
|
+
--namespace=my-plugin \
|
|
118
|
+
--dynamic
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Manual Scaffolding
|
|
124
|
+
|
|
125
|
+
### Simple Plugin (Pattern 1)
|
|
126
|
+
|
|
127
|
+
For single-feature plugins:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Create plugin directory
|
|
131
|
+
mkdir my-plugin
|
|
132
|
+
cd my-plugin
|
|
133
|
+
|
|
134
|
+
# Create main plugin file
|
|
135
|
+
touch my-plugin.php
|
|
136
|
+
|
|
137
|
+
# Create readme
|
|
138
|
+
touch readme.txt
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**my-plugin.php:**
|
|
142
|
+
```php
|
|
143
|
+
<?php
|
|
144
|
+
/**
|
|
145
|
+
* Plugin Name: My Plugin
|
|
146
|
+
* Description: Brief description
|
|
147
|
+
* Version: 1.0.0
|
|
148
|
+
* Author: Your Name
|
|
149
|
+
* License: GPL-2.0+
|
|
150
|
+
* Text Domain: my-plugin
|
|
151
|
+
*/
|
|
152
|
+
|
|
153
|
+
if (!defined('ABSPATH')) {
|
|
154
|
+
exit;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Plugin code here
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Organized Plugin (Pattern 2)
|
|
161
|
+
|
|
162
|
+
For plugins with multiple features:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
mkdir -p my-plugin/{includes,admin,public}
|
|
166
|
+
cd my-plugin
|
|
167
|
+
|
|
168
|
+
# Create files
|
|
169
|
+
touch my-plugin.php
|
|
170
|
+
touch readme.txt
|
|
171
|
+
touch includes/class-my-plugin.php
|
|
172
|
+
touch admin/class-my-plugin-admin.php
|
|
173
|
+
touch public/class-my-plugin-public.php
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Directory structure:**
|
|
177
|
+
```
|
|
178
|
+
my-plugin/
|
|
179
|
+
├── my-plugin.php
|
|
180
|
+
├── readme.txt
|
|
181
|
+
├── includes/
|
|
182
|
+
│ └── class-my-plugin.php
|
|
183
|
+
├── admin/
|
|
184
|
+
│ └── class-my-plugin-admin.php
|
|
185
|
+
└── public/
|
|
186
|
+
└── class-my-plugin-public.php
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Object-Oriented Plugin (Pattern 3)
|
|
190
|
+
|
|
191
|
+
For complex plugins with OOP structure:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
mkdir -p my-plugin/{includes,admin,public,languages}
|
|
195
|
+
cd my-plugin
|
|
196
|
+
|
|
197
|
+
# Create main files
|
|
198
|
+
touch my-plugin.php
|
|
199
|
+
touch uninstall.php
|
|
200
|
+
touch readme.txt
|
|
201
|
+
|
|
202
|
+
# Create class files
|
|
203
|
+
touch includes/class-my-plugin.php
|
|
204
|
+
touch includes/class-my-plugin-loader.php
|
|
205
|
+
touch includes/class-my-plugin-i18n.php
|
|
206
|
+
touch admin/class-my-plugin-admin.php
|
|
207
|
+
touch public/class-my-plugin-public.php
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Directory structure:**
|
|
211
|
+
```
|
|
212
|
+
my-plugin/
|
|
213
|
+
├── my-plugin.php
|
|
214
|
+
├── uninstall.php
|
|
215
|
+
├── readme.txt
|
|
216
|
+
├── includes/
|
|
217
|
+
│ ├── class-my-plugin.php
|
|
218
|
+
│ ├── class-my-plugin-loader.php
|
|
219
|
+
│ └── class-my-plugin-i18n.php
|
|
220
|
+
├── admin/
|
|
221
|
+
│ ├── class-my-plugin-admin.php
|
|
222
|
+
│ ├── css/
|
|
223
|
+
│ └── js/
|
|
224
|
+
├── public/
|
|
225
|
+
│ ├── class-my-plugin-public.php
|
|
226
|
+
│ ├── css/
|
|
227
|
+
│ └── js/
|
|
228
|
+
└── languages/
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Modern Plugin with Build Tools (Pattern 4)
|
|
232
|
+
|
|
233
|
+
For plugins with JavaScript/CSS build process:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
# Create directory structure
|
|
237
|
+
mkdir -p my-plugin/{src,dist,includes,admin,public,assets/{css,js,images}}
|
|
238
|
+
cd my-plugin
|
|
239
|
+
|
|
240
|
+
# Initialize npm
|
|
241
|
+
npm init -y
|
|
242
|
+
|
|
243
|
+
# Install build tools
|
|
244
|
+
npm install --save-dev webpack webpack-cli @wordpress/scripts
|
|
245
|
+
|
|
246
|
+
# Create configuration files
|
|
247
|
+
touch webpack.config.js
|
|
248
|
+
touch .babelrc
|
|
249
|
+
touch .eslintrc.js
|
|
250
|
+
|
|
251
|
+
# Create source files
|
|
252
|
+
touch src/index.js
|
|
253
|
+
touch src/style.scss
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
**package.json scripts:**
|
|
257
|
+
```json
|
|
258
|
+
{
|
|
259
|
+
"scripts": {
|
|
260
|
+
"build": "wp-scripts build",
|
|
261
|
+
"start": "wp-scripts start",
|
|
262
|
+
"lint:js": "wp-scripts lint-js",
|
|
263
|
+
"lint:css": "wp-scripts lint-style"
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Composer Integration
|
|
271
|
+
|
|
272
|
+
### Initialize Composer
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
cd my-plugin
|
|
276
|
+
|
|
277
|
+
# Initialize composer
|
|
278
|
+
composer init
|
|
279
|
+
|
|
280
|
+
# Install dependencies
|
|
281
|
+
composer require --dev phpunit/phpunit
|
|
282
|
+
composer require --dev squizlabs/php_codesniffer
|
|
283
|
+
composer require --dev wp-coding-standards/wpcs
|
|
284
|
+
|
|
285
|
+
# Configure PHPCS
|
|
286
|
+
./vendor/bin/phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
**composer.json:**
|
|
290
|
+
```json
|
|
291
|
+
{
|
|
292
|
+
"name": "vendor/my-plugin",
|
|
293
|
+
"description": "My WordPress Plugin",
|
|
294
|
+
"type": "wordpress-plugin",
|
|
295
|
+
"license": "GPL-2.0+",
|
|
296
|
+
"autoload": {
|
|
297
|
+
"psr-4": {
|
|
298
|
+
"MyPlugin\\": "includes/"
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
"require": {
|
|
302
|
+
"php": ">=7.4"
|
|
303
|
+
},
|
|
304
|
+
"require-dev": {
|
|
305
|
+
"phpunit/phpunit": "^9.0",
|
|
306
|
+
"squizlabs/php_codesniffer": "^3.7",
|
|
307
|
+
"wp-coding-standards/wpcs": "^3.0"
|
|
308
|
+
},
|
|
309
|
+
"scripts": {
|
|
310
|
+
"test": "phpunit",
|
|
311
|
+
"lint": "phpcs --standard=WordPress includes/ admin/ public/",
|
|
312
|
+
"lint:fix": "phpcbf --standard=WordPress includes/ admin/ public/"
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## Git Integration
|
|
320
|
+
|
|
321
|
+
### Initialize Git Repository
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
cd my-plugin
|
|
325
|
+
|
|
326
|
+
# Initialize git
|
|
327
|
+
git init
|
|
328
|
+
|
|
329
|
+
# Create .gitignore
|
|
330
|
+
cat > .gitignore << EOF
|
|
331
|
+
# Dependencies
|
|
332
|
+
/vendor/
|
|
333
|
+
/node_modules/
|
|
334
|
+
|
|
335
|
+
# Build files
|
|
336
|
+
/dist/
|
|
337
|
+
/build/
|
|
338
|
+
|
|
339
|
+
# OS files
|
|
340
|
+
.DS_Store
|
|
341
|
+
Thumbs.db
|
|
342
|
+
|
|
343
|
+
# IDE files
|
|
344
|
+
.vscode/
|
|
345
|
+
.idea/
|
|
346
|
+
*.sublime-project
|
|
347
|
+
*.sublime-workspace
|
|
348
|
+
|
|
349
|
+
# WordPress
|
|
350
|
+
wp-config.php
|
|
351
|
+
.htaccess
|
|
352
|
+
|
|
353
|
+
# Logs
|
|
354
|
+
*.log
|
|
355
|
+
npm-debug.log*
|
|
356
|
+
|
|
357
|
+
# Environment
|
|
358
|
+
.env
|
|
359
|
+
.env.local
|
|
360
|
+
EOF
|
|
361
|
+
|
|
362
|
+
# Initial commit
|
|
363
|
+
git add .
|
|
364
|
+
git commit -m "Initial commit"
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### GitHub Repository Setup
|
|
368
|
+
|
|
369
|
+
```bash
|
|
370
|
+
# Create GitHub repository (using GitHub CLI)
|
|
371
|
+
gh repo create my-plugin --public --source=. --remote=origin
|
|
372
|
+
|
|
373
|
+
# Push to GitHub
|
|
374
|
+
git push -u origin main
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
## Plugin Boilerplate Templates
|
|
380
|
+
|
|
381
|
+
### WordPress Plugin Boilerplate
|
|
382
|
+
|
|
383
|
+
```bash
|
|
384
|
+
# Clone the boilerplate
|
|
385
|
+
git clone https://github.com/DevinVinson/WordPress-Plugin-Boilerplate.git my-plugin
|
|
386
|
+
|
|
387
|
+
cd my-plugin
|
|
388
|
+
|
|
389
|
+
# Run the rename script (if available) or manually rename
|
|
390
|
+
# Replace 'plugin-name' with your plugin slug
|
|
391
|
+
# Replace 'Plugin_Name' with your plugin class prefix
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
### Underscores Plugin Generator
|
|
395
|
+
|
|
396
|
+
Use the online generator at [wppb.me](https://wppb.me/):
|
|
397
|
+
|
|
398
|
+
1. Enter plugin details
|
|
399
|
+
2. Select options (CPT, taxonomy, etc.)
|
|
400
|
+
3. Download generated plugin
|
|
401
|
+
4. Extract to plugins directory
|
|
402
|
+
|
|
403
|
+
---
|
|
404
|
+
|
|
405
|
+
## Scaffolding Checklist
|
|
406
|
+
|
|
407
|
+
### Initial Setup
|
|
408
|
+
|
|
409
|
+
- [ ] Create plugin directory with proper slug
|
|
410
|
+
- [ ] Create main plugin file with header
|
|
411
|
+
- [ ] Create readme.txt
|
|
412
|
+
- [ ] Initialize Git repository
|
|
413
|
+
- [ ] Create .gitignore
|
|
414
|
+
- [ ] Set up directory structure based on complexity
|
|
415
|
+
|
|
416
|
+
### Development Tools
|
|
417
|
+
|
|
418
|
+
- [ ] Initialize Composer (if using PHP dependencies)
|
|
419
|
+
- [ ] Initialize npm (if using JavaScript/CSS build)
|
|
420
|
+
- [ ] Configure PHPCS with WordPress standards
|
|
421
|
+
- [ ] Set up ESLint for JavaScript
|
|
422
|
+
- [ ] Configure build scripts
|
|
423
|
+
|
|
424
|
+
### Code Quality
|
|
425
|
+
|
|
426
|
+
- [ ] Set up PHPUnit for testing
|
|
427
|
+
- [ ] Configure code linting (PHPCS, ESLint)
|
|
428
|
+
- [ ] Add pre-commit hooks (optional)
|
|
429
|
+
- [ ] Set up continuous integration (optional)
|
|
430
|
+
|
|
431
|
+
### Documentation
|
|
432
|
+
|
|
433
|
+
- [ ] Create README.md for GitHub
|
|
434
|
+
- [ ] Create readme.txt for WordPress.org
|
|
435
|
+
- [ ] Add inline code documentation
|
|
436
|
+
- [ ] Create CHANGELOG.md
|
|
437
|
+
|
|
438
|
+
---
|
|
439
|
+
|
|
440
|
+
## Quick Start Commands
|
|
441
|
+
|
|
442
|
+
### Simple Plugin (No Build Tools)
|
|
443
|
+
|
|
444
|
+
```bash
|
|
445
|
+
# Create and scaffold
|
|
446
|
+
mkdir my-plugin && cd my-plugin
|
|
447
|
+
wp scaffold plugin . --plugin_name="My Plugin" --skip-tests
|
|
448
|
+
|
|
449
|
+
# Initialize git
|
|
450
|
+
git init
|
|
451
|
+
git add .
|
|
452
|
+
git commit -m "Initial commit"
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
### Modern Plugin (With Build Tools)
|
|
456
|
+
|
|
457
|
+
```bash
|
|
458
|
+
# Create and scaffold
|
|
459
|
+
mkdir my-plugin && cd my-plugin
|
|
460
|
+
wp scaffold plugin . --plugin_name="My Plugin"
|
|
461
|
+
|
|
462
|
+
# Initialize npm and install tools
|
|
463
|
+
npm init -y
|
|
464
|
+
npm install --save-dev @wordpress/scripts
|
|
465
|
+
|
|
466
|
+
# Initialize composer
|
|
467
|
+
composer init --no-interaction
|
|
468
|
+
composer require --dev phpunit/phpunit wp-coding-standards/wpcs
|
|
469
|
+
|
|
470
|
+
# Initialize git
|
|
471
|
+
git init
|
|
472
|
+
git add .
|
|
473
|
+
git commit -m "Initial commit"
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
### Block Plugin
|
|
477
|
+
|
|
478
|
+
```bash
|
|
479
|
+
# Create plugin directory
|
|
480
|
+
mkdir my-block-plugin && cd my-block-plugin
|
|
481
|
+
|
|
482
|
+
# Scaffold block plugin
|
|
483
|
+
npx @wordpress/create-block my-block
|
|
484
|
+
|
|
485
|
+
# Initialize git
|
|
486
|
+
git init
|
|
487
|
+
git add .
|
|
488
|
+
git commit -m "Initial commit"
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
---
|
|
492
|
+
|
|
493
|
+
## Post-Scaffolding Tasks
|
|
494
|
+
|
|
495
|
+
### 1. Update Plugin Header
|
|
496
|
+
|
|
497
|
+
Edit main plugin file and update:
|
|
498
|
+
- Plugin Name
|
|
499
|
+
- Description
|
|
500
|
+
- Author information
|
|
501
|
+
- Version number
|
|
502
|
+
- Text Domain
|
|
503
|
+
|
|
504
|
+
### 2. Update readme.txt
|
|
505
|
+
|
|
506
|
+
Edit readme.txt and update:
|
|
507
|
+
- Plugin name and description
|
|
508
|
+
- Tags
|
|
509
|
+
- Requires at least / Tested up to
|
|
510
|
+
- Installation instructions
|
|
511
|
+
- FAQ section
|
|
512
|
+
|
|
513
|
+
### 3. Configure Build Tools
|
|
514
|
+
|
|
515
|
+
If using build tools:
|
|
516
|
+
|
|
517
|
+
```bash
|
|
518
|
+
# Install dependencies
|
|
519
|
+
npm install
|
|
520
|
+
composer install
|
|
521
|
+
|
|
522
|
+
# Run initial build
|
|
523
|
+
npm run build
|
|
524
|
+
|
|
525
|
+
# Start development mode
|
|
526
|
+
npm run start
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
### 4. Set Up Testing
|
|
530
|
+
|
|
531
|
+
```bash
|
|
532
|
+
# Install WordPress test suite
|
|
533
|
+
bin/install-wp-tests.sh wordpress_test root '' localhost latest
|
|
534
|
+
|
|
535
|
+
# Run tests
|
|
536
|
+
composer test
|
|
537
|
+
# or
|
|
538
|
+
npm test
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
### 5. Configure Linting
|
|
542
|
+
|
|
543
|
+
```bash
|
|
544
|
+
# Lint PHP
|
|
545
|
+
composer run lint
|
|
546
|
+
|
|
547
|
+
# Lint JavaScript
|
|
548
|
+
npm run lint:js
|
|
549
|
+
|
|
550
|
+
# Lint CSS
|
|
551
|
+
npm run lint:css
|
|
552
|
+
|
|
553
|
+
# Auto-fix issues
|
|
554
|
+
composer run lint:fix
|
|
555
|
+
npm run lint:js -- --fix
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
---
|
|
559
|
+
|
|
560
|
+
## Best Practices
|
|
561
|
+
|
|
562
|
+
### DO
|
|
563
|
+
|
|
564
|
+
✅ Use WP-CLI for consistent scaffolding
|
|
565
|
+
✅ Initialize version control immediately
|
|
566
|
+
✅ Set up build tools before writing code
|
|
567
|
+
✅ Configure linting and testing early
|
|
568
|
+
✅ Use proper text domain matching plugin slug
|
|
569
|
+
✅ Follow WordPress coding standards from start
|
|
570
|
+
✅ Create .gitignore to exclude build files
|
|
571
|
+
|
|
572
|
+
### DON'T
|
|
573
|
+
|
|
574
|
+
❌ Manually create all files (use scaffolding tools)
|
|
575
|
+
❌ Skip version control setup
|
|
576
|
+
❌ Commit build files to repository
|
|
577
|
+
❌ Use generic function/class names
|
|
578
|
+
❌ Skip testing setup
|
|
579
|
+
❌ Ignore coding standards
|
|
580
|
+
❌ Hardcode plugin paths or URLs
|
|
581
|
+
|
|
582
|
+
---
|
|
583
|
+
|
|
584
|
+
## Troubleshooting
|
|
585
|
+
|
|
586
|
+
### WP-CLI Not Found
|
|
587
|
+
|
|
588
|
+
```bash
|
|
589
|
+
# Verify installation
|
|
590
|
+
which wp
|
|
591
|
+
|
|
592
|
+
# Add to PATH (macOS/Linux)
|
|
593
|
+
export PATH=$PATH:/usr/local/bin
|
|
594
|
+
|
|
595
|
+
# Reinstall if needed
|
|
596
|
+
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
|
597
|
+
chmod +x wp-cli.phar
|
|
598
|
+
sudo mv wp-cli.phar /usr/local/bin/wp
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
### Composer Autoload Not Working
|
|
602
|
+
|
|
603
|
+
```bash
|
|
604
|
+
# Regenerate autoload files
|
|
605
|
+
composer dump-autoload
|
|
606
|
+
|
|
607
|
+
# Verify autoload in main plugin file
|
|
608
|
+
require_once plugin_dir_path(__FILE__) . 'vendor/autoload.php';
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
### Build Tools Not Working
|
|
612
|
+
|
|
613
|
+
```bash
|
|
614
|
+
# Clear npm cache
|
|
615
|
+
npm cache clean --force
|
|
616
|
+
|
|
617
|
+
# Remove node_modules and reinstall
|
|
618
|
+
rm -rf node_modules package-lock.json
|
|
619
|
+
npm install
|
|
620
|
+
|
|
621
|
+
# Verify webpack config
|
|
622
|
+
npm run build -- --mode=development
|
|
623
|
+
```
|
|
624
|
+
|