Theme Commands
Streamlined commands for Wikit theme development, build processes, and asset management.
Overview
Theme commands simplify working with Wikit-based WordPress themes, providing shortcuts for common development tasks.
Theme Development
Start Development Server
wdg theme dev [project] [theme-name]Examples:
# Auto-detect theme in project
wdg theme dev my-site
# Specific theme
wdg theme dev my-site custom-theme
# Current directory (if in theme folder)
wdg theme devWhat it does:
- Detects theme directory
- Runs
npm startornpm run dev - Watches for file changes
- Auto-compiles assets
- Enables hot module replacement
Build Theme Assets
wdg theme build [project] [theme-name] [--prod]Examples:
# Build for production
wdg theme build my-site
# Development build
wdg theme build my-site --dev
# Specific theme
wdg theme build my-site custom-themeWatch Mode
wdg theme watch [project] [theme-name]Continuously rebuilds assets on file changes.
Theme Creation
Create New Theme
wdg theme create <project> <theme-name> [--template=wikit]Examples:
# Create Wikit-based theme
wdg theme create my-site custom-theme
# Create from template
wdg theme create my-site client-theme --template=wikit-pro
# Create minimal theme
wdg theme create my-site simple-theme --template=minimalAvailable Templates:
wikit(default) - Full Wikit frameworkwikit-pro- Wikit with advanced blocksminimal- Bare-bones starterchild- Child theme of Wikit
Initialize Theme Repository
wdg theme init [project] [theme-name]Initializes git repository in theme directory:
cd wp-content/themes/custom-theme
git init
git add .
git commit -m "Initial theme setup"Theme Management
List Themes
wdg theme list [project]Output:
Themes for my-site:
custom-theme (active)
Path: wp-content/themes/custom-theme
Template: wikit
Version: 1.0.0
Status: ✓ All assets compiled
Indexed: Yes (450 vectors)
wikit-theme
Path: wp-content/themes/wikit-theme
Template: parent
Version: 2.1.0
Status: ✓ Ready
Indexed: Yes (3,200 vectors)Activate Theme
wdg theme activate <project> <theme-name>Example:
wdg theme activate my-site custom-themeTheme Info
wdg theme info <project> <theme-name>Output:
Theme: custom-theme
Project: my-site
Status: Active
Version: 1.0.0
Author: WDG Development Team
Template: wikit
Description: Custom theme built on Wikit framework
Directory: wp-content/themes/custom-theme
Size: 2.4 MB
Files: 145
Build Configuration:
✓ package.json found
✓ webpack.config.js configured
✓ Source maps: enabled
✓ Hot reload: configured
Assets:
CSS: dist/style.css (45 KB)
JS: dist/main.js (128 KB)
Images: 24 files (1.2 MB)
Wikit Blocks Used:
→ wdg/hero
→ wdg/grid
→ wdg/button
→ wdg/testimonials
(15 total)Asset Management
Compile Assets
wdg theme compile <project> <theme-name> [--type=css|js|all]Examples:
# Compile all assets
wdg theme compile my-site custom-theme
# CSS only
wdg theme compile my-site custom-theme --type=css
# JavaScript only
wdg theme compile my-site custom-theme --type=jsMinify Assets
wdg theme minify <project> <theme-name>Minifies and optimizes all theme assets.
Clean Build Artifacts
wdg theme clean <project> <theme-name>Removes dist/, build/, and node_modules/.
Install Dependencies
wdg theme install <project> <theme-name>Runs npm install in theme directory.
Wikit Integration
List Available Blocks
wdg theme blocks [--category=<category>]Output:
Wikit Gutenberg Blocks:
Layout Blocks:
→ wdg/hero - Hero section with background
→ wdg/grid - Responsive grid layout
→ wdg/columns - Multi-column layout
→ wdg/section - Content section wrapper
→ wdg/container - Constrained container
Content Blocks:
→ wdg/button - Call-to-action button
→ wdg/heading - Styled heading
→ wdg/text - Rich text content
→ wdg/image - Responsive image
→ wdg/video - Video embed
...60+ blocks totalAdd Wikit Block to Theme
wdg theme add-block <project> <theme-name> <block-name>Example:
wdg theme add-block my-site custom-theme wdg/testimonialsCreates:
- Block registration in
functions.php - Custom styles in
assets/scss/blocks/_testimonials.scss - JavaScript in
assets/js/blocks/testimonials.js
Generate Block Template
wdg theme generate-block <project> <theme-name> <block-name>Creates custom Gutenberg block with Wikit patterns:
wdg theme generate-block my-site custom-theme custom/product-cardTheme Configuration
Configure Build System
wdg theme config <project> <theme-name>Interactive configuration:
- Webpack settings
- Build output paths
- Source map generation
- Hot module replacement
- Asset optimization
Set Theme Options
wdg theme set <project> <theme-name> <option> <value>Examples:
# Enable auto-update
wdg theme set my-site custom-theme auto-update true
# Set primary color
wdg theme set my-site custom-theme primary-color "#0066cc"
# Configure breakpoints
wdg theme set my-site custom-theme mobile-breakpoint 768pxTheme Testing
Lint Theme Code
wdg theme lint <project> <theme-name> [--fix]Runs linters:
- PHP: PHPCS with WordPress Coding Standards
- JavaScript: ESLint
- CSS: Stylelint
With auto-fix:
wdg theme lint my-site custom-theme --fixRun Theme Tests
wdg theme test <project> <theme-name>Runs:
- PHPUnit tests
- Jest tests
- Accessibility tests
Check Theme Requirements
wdg theme check <project> <theme-name>Output:
Theme Requirements Check:
WordPress Compatibility:
✓ Minimum version: 6.0
✓ PHP version: 8.0+
✓ Required functions defined
✓ No deprecated functions
Theme Review:
✓ style.css header complete
✓ screenshot.png present
✓ Template files present
⚠ Missing readme.txt
✓ Proper text domain usage
Performance:
✓ No inline CSS
✓ Scripts enqueued properly
⚠ Consider lazy loading images
✓ Minified assets in dist/
Security:
✓ Escaping output
✓ Sanitizing input
✓ Nonces for forms
✓ No hardcoded credentialsTheme Deployment
Package Theme
wdg theme package <project> <theme-name> [--output=<path>]Creates deployment-ready ZIP file:
wdg theme package my-site custom-theme --output=releases/Output:
Packaging theme: custom-theme
✓ Building production assets
✓ Removing development files
✓ Cleaning dependencies
✓ Creating archive
Package created: releases/custom-theme-1.0.0.zip (1.8 MB)
Included:
- Compiled CSS/JS
- PHP templates
- Images and fonts
- style.css and functions.php
Excluded:
- node_modules/
- src/ (source files)
- .git/
- Development configsDeploy Theme
wdg theme deploy <project> <theme-name> <environment>Environments:
staging- Deploy to staging serverproduction- Deploy to productioncustom- Custom deployment target
Theme Backup
Backup Theme
wdg theme backup <project> <theme-name>Creates timestamped backup including:
- Theme files
- Compiled assets
- Database theme options
- Customizer settings
Restore Theme
wdg theme restore <project> <backup-file>Theme Analytics
Theme Performance
wdg theme perf <project> <theme-name>Output:
Performance Analysis: custom-theme
Asset Sizes:
CSS: 45 KB (12 KB gzipped)
JavaScript: 128 KB (38 KB gzipped)
Images: 1.2 MB (optimized)
Load Time Impact:
CSS parse time: 25ms
JS execution time: 180ms
Total blocking time: 205ms
Optimization Suggestions:
✓ CSS minified
✓ JS minified
⚠ Consider code splitting for JS
✓ Images optimized
→ Potential savings: 45 KBTheme Usage Stats
wdg theme stats <project> <theme-name>Shows:
- Template usage frequency
- Block usage statistics
- Most used components
- Unused files
Advanced Features
Custom Theme Hooks
# List available theme hooks
wdg theme hooks list <project> <theme-name>
# Generate hook boilerplate
wdg theme hooks generate <project> <theme-name> <hook-name>Theme Translations
# Generate .pot file
wdg theme translate <project> <theme-name> --generate-pot
# Update translations
wdg theme translate <project> <theme-name> --update
# Check translation coverage
wdg theme translate <project> <theme-name> --checkTheme Screenshots
# Generate screenshot.png automatically
wdg theme screenshot <project> <theme-name>
# Custom screenshot
wdg theme screenshot <project> <theme-name> --url=/custom-page --viewport=1200x900Common Workflows
New Theme Development
# 1. Create theme
wdg theme create my-site client-theme
# 2. Start development
wdg theme dev my-site client-theme
# 3. Make changes...
# (Auto-rebuilds on save)
# 4. Test and lint
wdg theme lint my-site client-theme --fix
wdg theme check my-site client-theme
# 5. Build for production
wdg theme build my-site client-theme --prod
# 6. Package for deployment
wdg theme package my-site client-themeUpdating Wikit Theme
# 1. Pull latest Wikit
wdg repo pull wikit-theme
# 2. Restart project
wdg restart my-site
# 3. Rebuild child theme
wdg theme build my-site custom-theme
# 4. Test
wdg theme check my-site custom-themeSee Also: