wp-block-themes
WP Block Themes
When to use
Use this skill for block theme work such as:
- Editing
theme.json(presets, settings, styles, per-block styles) - Adding or changing templates (
templates/*.html) and template parts (parts/*.html) - Adding patterns (
patterns/*.php) and controlling inserter visibility - Adding style variations (
styles/*.json) - Debugging "styles not applying" / "editor doesn't reflect theme.json"
Inputs required
- Repo root and which theme is targeted
- Target WordPress version range (theme.json version varies by core version)
- Where the issue manifests: Site Editor, post editor, frontend, or all
Procedure
1) Verify block theme structure
Required structure:
theme-name/
├── style.css # Theme header (required)
├── theme.json # Global settings and styles (required)
├── templates/ # Full page templates
│ ├── index.html # Fallback template (required)
│ ├── single.html
│ ├── archive.html
│ └── ...
├── parts/ # Template parts
│ ├── header.html
│ ├── footer.html
│ └── ...
├── patterns/ # Block patterns (optional)
│ └── *.php
└── styles/ # Style variations (optional)
└── *.json
2) theme.json structure
Settings (what the UI allows):
{
"$schema": "https://schemas.wp.org/trunk/theme.json",
"version": 3,
"settings": {
"color": {
"palette": [
{ "slug": "primary", "color": "#0073aa", "name": "Primary" }
]
},
"typography": {
"fontSizes": [
{ "slug": "small", "size": "14px", "name": "Small" }
]
},
"layout": {
"contentSize": "800px",
"wideSize": "1200px"
}
}
}
Styles (how it looks by default):
{
"styles": {
"color": {
"background": "var(--wp--preset--color--base)",
"text": "var(--wp--preset--color--contrast)"
},
"elements": {
"link": {
"color": { "text": "var(--wp--preset--color--primary)" }
}
},
"blocks": {
"core/button": {
"color": {
"background": "var(--wp--preset--color--primary)"
}
}
}
}
}
3) Templates and template parts
Templates (templates/*.html):
<!-- wp:template-part {"slug":"header"} /-->
<!-- wp:group {"tagName":"main"} -->
<main class="wp-block-group">
<!-- wp:post-title /-->
<!-- wp:post-content /-->
</main>
<!-- /wp:group -->
<!-- wp:template-part {"slug":"footer"} /-->
Template parts (parts/*.html):
- Must NOT be nested in subdirectories
- Must have matching
slugin template-part block
4) Patterns
Create patterns in patterns/*.php:
<?php
/**
* Title: Hero Section
* Slug: theme-name/hero
* Categories: featured
* Keywords: hero, banner
*/
?>
<!-- wp:cover {"url":"..."} -->
...
<!-- /wp:cover -->
5) Style variations
Create variations in styles/*.json:
{
"$schema": "https://schemas.wp.org/trunk/theme.json",
"version": 3,
"title": "Dark Mode",
"settings": {},
"styles": {
"color": {
"background": "#1a1a1a",
"text": "#ffffff"
}
}
}
6) Style hierarchy (debugging)
Styles apply in this order (later overrides earlier):
- Core defaults
- theme.json (parent theme)
- theme.json (child theme)
- User customizations (stored in DB)
If your theme.json changes don't appear:
- Check if user customizations override them
- Clear any caches
- Validate JSON syntax
Verification
- Site Editor reflects changes (Styles UI, templates, patterns)
- Frontend renders with expected styles
- If styles aren't changing, confirm user customizations don't override
Failure modes / debugging
Common issues:
- Wrong theme root: Editing inactive theme
- User overrides: Customizations in DB override theme.json
- Invalid JSON: Typos prevent application
- Wrong folder: Templates/parts in wrong location or nested
Debug commands:
# Validate theme.json
cat theme.json | python3 -m json.tool
# Check template files
ls -la templates/ parts/
# Verify theme is active
wp theme list --status=active
Escalation
Consult canonical docs:
More from vapvarun/claude-backup
php
Modern PHP development best practices including PHP 8.x features, OOP patterns, error handling, security, testing, and performance optimization. Use when writing PHP code, reviewing PHP projects, debugging PHP issues, or implementing PHP features outside of WordPress/Laravel specific contexts.
45laravel
Complete Laravel development guide covering Eloquent, Blade, testing with Pest/PHPUnit, queues, caching, API resources, migrations, and Laravel best practices. Use when building Laravel applications, writing Laravel code, implementing features in Laravel, debugging Laravel issues, or when user mentions Laravel, Eloquent, Blade, Artisan, or PHP frameworks.
23email-marketing
Create email marketing campaigns including newsletters, drip sequences, promotional emails, and transactional emails. Use when writing email copy, designing email templates, or planning email automation.
14javascript
Write modern JavaScript/ES6+ code following best practices for performance, security, and maintainability. Use when writing JS code, fixing bugs, or implementing frontend functionality.
14html-markup
Write semantic, accessible HTML5 markup following best practices for structure, SEO, and accessibility. Use when creating HTML templates, fixing markup issues, or building web page structures.
12landing-page
Create high-converting landing pages with persuasive copy, clear CTAs, social proof, and optimized structure. Use when building sales pages, product pages, lead capture pages, or conversion-focused pages.
12