Building Modern WordPress Themes with WP Rig & AI
A Hands-On Engineering & AI-Native Architecture Masterclass
git clone https://github.com/wprig/wprig.git wprig-workshop
cd wprig-workshop && npm install && npm run dev
Rob Ruiz
WP Rig Lead & Core Contributor
Custom plugins, custom themes, headless, custom blocks, you name it.
Multiple Anthropic Certifications
Thanks and disclaimer
Thanks to all other contributors
- Jan Tack
- Carl Brubaker
Dev has been fast and testing has been limited. Please submit issues and/or PRs on Github if you find anything.
Workshop Roadmap
90 Minutes | 5 Core Milestones
- 0. Setup & Architecture Concepts (15 mins)
- 1. Scenario 1: Agency Corporate Theme (25 mins)
- 2. Scenario 2: Free Block Theme (WP.org) (20 mins)
- 3. Scenario 3: Custom Child Theme Vibe Coding (20 mins)
- 5. Live Q&A & Ecosystem Wrap-Up (10 mins)
The Theme Dilemma
Part 1: Classic Starter Themes
- Monolithic
functions.phpwith procedural spaghetti code - Outdated or complete absence of build systems
- Zero built-in quality gates for accessibility, standards, or PHP quality
- Lack of direction, convention, automations, or QOL features.
- Little to no configurability – one model
The Theme Dilemma
Part 2: Pure Modern Block Themes
- Hard to build custom interactive features without heavy JavaScript
- Fragile site-editor layouts dependent on third-party plugins
- Lack of strict architectural patterns for enterprise custom builds
The Problem with AI Code
Without strict rails, AI coding assistants hallucinate, drift, and break theme conventions.
“AI is confident and eager — WP Rig provides direction, opinions, and assertions.”
Model Context Protocol
npm run mcp
A dynamic Model Context Protocol server providing AI agents real-time, zero-latency access to WP Rig documentation, theme configuration, and architectural rules.
Agent Skills & Protocol
.ai/skills/ & .ai/agent-state.md
Version-controlled instructions for Architecture, Feature Specs (SPEC.md), and Scaffolding—preventing context rot across multi-step dev sessions.
esbuild + Lightning CSS
Sub-Second Asset Compilation
Lightning-fast TypeScript and CSS transpilation delivering optimized, minified assets instantly. Custom build scripts provide QOL enhancements like hot module reloading, custom media breakpoints (variable-based breakpoints) and dynamic theme asset referencing in CSS.
Modular OOP PHP
Namespaced Components in inc/Components/
Clean, modular PHP architecture where every theme feature is a self-contained, namespaced PHP component with strict single responsibility.
Purpose-Focused Components
- Located in
inc/Components/ - Explicit KDoc contracts for every class and method
- Clean dependency injection and zero global scope pollution
Cookie-Based Critical CSS
wprig_critical_cachedcookie mechanism- Inlines critical styles on first page load for sub-100ms FCP
- Seamlessly switches to cached stylesheet link on repeat visits
Front-End Dev Toolbar
- Element selector and prompt builder
- A11y violation detection and remediation including light/dark mode toggling.
- Template usage breakdown
Dev Toolbar Prompt Generator
- Extracts computed DOM layout metrics & template paths
- One-click “Copy Agent Prompt” for instant AI chat context
- Generates precise CSS fix snippets directly from browser state
Pre-Flight Quality Gates
npm run ai:check
- PHPCS (WordPress Coding Standards)
- PHPStan (Static Analysis)
- ESLint (JavaScript Standards)
- Stylelint (CSS Rules)
Contract Specs & Verification
- Authoring
SPEC.mdbefore writing code prevents scope drift - Pre-written Playwright E2E tests provide automated criteria
- AI agents autonomously run, verify, and self-correct in a loop
One Engine, 3 Scenarios
Today’s Hands-On Workshop Focus Areas
Agencies should build custom themes – easier!
“Agencies used to resist developing custom themes because the build vs buy did not make sense. AI has changed this rapidly and dramatically.”
The Agency Team
Goal: Bespoke Corporate Web & Scalable Engineering
- Design system consistency matching strict Figma branding
- Fast multi-developer build execution
- Strict pre-flight CI/CD quality gates
Central Configuration
config/config.json
Single source of truth for build settings, theme metadata, OKLCH color pipelines, and component toggles across team developers.
Agency PHPCS & Agent Skills
- Customizable PHPCS sniffs in
phpcs.xml.distfor agency standards - Version-controlled agent skills in
.ai/skills/committed to Git
Open Component Registry
npm run rig
Discover, pull/inject, publish, and share modular, DRY theme components across multiple theme projects without code duplication. For agencies, a private component registry can be easily configured.
Dev Toolbar & Cache Purging
- Shadow DOM React Developer Toolbar (
dev-toolbar.js) - One-click front-end AJAX cache purging via
wp_ajax_wprig_purge_cache
Dev Nav Lock & Nav Testing
Alt/Optionkey shortcut locks mobile navigation open during CSS styling- CSS WP Rig comes with a rigorous navigation testing system to help you iterate on your navigation, as this is one of the most important parts of a WP theme.
E2E Navigation & Visual Gates
- Playwright E2E mobile navigation suite
- Lighthouse CI performance budgets (
npm run test:perf) - Pixel-match visual regression snapshots (
npm run test:e2e:screenshot)
Hands-On Walkthrough
- Use
Alt/Optionnav lock while editing header CSS - Inspect OKLCH colors & template bounds in Dev Toolbar
- Register SVG icon set in
inc/Components/SVG/ - Pull shared Bento component via
npm run rig
We should help creative web designers more easily contribute block-based themes to WordPress.org
“We want more block-based themes. However, between the nuances with block-based theme development fear of rejection by the theme review team, serious barriers exist for these invividuals.”
The Solo Contributor
Goal: 100% WordPress.org Directory Standards Compliance
- 100% WordPress Core standards compliance
- Zero third-party runtime JavaScript bloat
- Accessibility out of the box
Design Tokens & Variations
- Global color palettes, typography scales, & spacing in
theme.json - Multi-scheme
styles/*.jsonvariations (e.g. dark mode & typography presets) - Full Site Editing template parts in
templates/
CSS Container Queries
- Solving nested block card layouts with
@containerqueries - Fluid typography & spacing with responsive
clamp()rules - Zero media query clutter for individual block cards
Block Scaffolding & Export
- Scaffold custom blocks:
npm run block:new - Auto-registration via
inc/Blocks/Component.php - Promote block to standalone plugin:
npm run block:promote-plugin
Classic-to-Block Conversion
npm run block-based
Automatically prunes classic PHP template hooks and aligns existing theme structures with Full Site Editing standards in a single command.
Automated Accessibility (`axe-core`)
- Integrated
@axe-core/playwrighttest suite - Catches color contrast and ARIA errors during
npm run ai:check - Documentation guide available in
docs/accessibility-testing.md
In-Browser A11y Inspector
- Real-time color contrast ratio scoring (WCAG AA/AAA)
- Touch-target size validation (44x44px min threshold)
- Interactive remediation controls directly inside Dev Toolbar
Hands-On Walkthrough
- Customize
theme.json& addstyles/dark.json - Scaffold block with
npm run block:new - Inspect A11y & template bounds in Dev Toolbar
- Run
npm run ai:checkfor zero warnings
Some people rely on a parent theme
“It would be nice if there was an easy drop-in way we could use the build systems of WP Rig for child theme development.”
The DIY Marketer
Goal: Extending Ollie / 2025 Non-Destructively
- Non-destructive customizations
- Preserving parent theme update paths
- Fast AI-assisted prototyping & vibe coding
The `childify` Script
npm run childify
Converts WP Rig into a lean, production-ready child theme targeting Ollie, Twenty Twenty-Five, or classic parent themes in a single command.
Bun Runtime Support
bun run setup-child:bun
Choice of Node or ultra-fast Bun execution delivering instant asset compilation and zero-config child theme builds.
Rector & Hybrid Architecture
- Automated PHP upgrades via Rector (
composer fix) - Hybrid OOP component architecture safely overrides classic or block parent themes
Safe AI Vibe Coding
- Vibe code new child components with zero risk to parent files
- Copy DOM metrics & template paths from Dev Toolbar into AI chats
- Instant hot-reload feedback loop reflects AI edits immediately
Hands-On Walkthrough
- Run
npm run childifytargeting Ollie / Twenty Twenty-Five - Prompt AI to vibe code an animated hero section
- Confirm parent theme files remain 100% untouched
Synthesizing the Three Paths
“Whether you’re shipping to the WP.org directory, leading an agency team on enterprise custom builds, or vibe coding a child theme for Ollie, WP Rig provides the exact same high-speed, standards-compliant engine.”
Three Scenarios, One Engine
| Feature | Free Block Theme | Custom Agency Theme | DIY Child Theme |
|---|---|---|---|
| Audience | Solo Developer | Agency Multi-Dev Team | DIY Marketer / Creative |
| Focus | WP.org Directory Standards | Design System & Governance | Non-Destructive Overrides |
| Key Tooling | axe-core & Plugin Export |
Dev Toolbar & Registry (rig) |
childify Script & Bun Support |
| AI Guardrails | Pre-Flight Gates (ai:check) |
Git Agent Skills (.ai/skills/) |
Safe AI Vibe Coding Sandbox |
100% Free & Open Source
GPL Licensed | Zero Lock-In
- 100% GPL Licensed: Completely free open-source framework
- Zero SaaS Lock-in: No proprietary plugins, subscriptions, or paywalls
- Complete Ownership: You own 100% of your source code
What else can WP Rig do?
This entire presentation was developed in a custom theme built with WP Rig
- Completely authored in Gutenberg
- Presentation features: A custom slide deck feature powered by Reveal.js and other custom JS.
- Dogfooding WP Rig: This theme was built 3 weeks ago in about 3 hours containing this feature as a spec.
Live Q&A & Next Steps
Thank you for building with WP Rig!
Workshop Guide: wprig.io > Learn V3
GitHub Repo: github.com/wprig/wprig
Community: Join the WP Rig Discord & Discussions
