Starting a custom project from a clean folder tree rather than stripping down an existing multi-purpose parent theme saves hours of cleanup and prevents CSS specificity battles. In this guide, you will learn how to build a lightweight WordPress Starter Theme with theme.json using modern WordPress 6.x standards.
Why Build a WordPress Starter Theme with theme.json?
Bespoke client builds rarely need megamenu option panels, bundled icon fonts, or unused WooCommerce styling on informational pages. Keeping core templates semantic and organizing optional subsystems inside an /inc/ directory ensures every byte loaded in production is intentional.
Step 1: Set Up Core Templates & after_setup_theme
Every solid classic or hybrid starter theme separates global wrappers (`header.php`, `footer.php`) from hierarchy views (`index.php`, `page.php`, `single.php`, `archive.php`, `search.php`, `404.php`), anchored by an after_setup_theme setup callback in functions.php:
function starter_theme_setup() {
load_theme_textdomain( 'starter-theme', get_template_directory() . '/languages' );
add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'style', 'script' ) );
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'starter-theme' ),
) );
}
add_action( 'after_setup_theme', 'starter_theme_setup' );
Prefix Consistency & Security Guards
Use one consistent snake_case function prefix matching your theme slug across every helper, filter, and menu location, and place if ( ! defined( 'ABSPATH' ) ) { exit; } at the top of every PHP file.
Step 2: Configure Design Tokens Inside theme.json (Version 3)
Even in classic PHP themes, dropping a lean theme.json configuration in the theme root synchronizes your brand color palette and readable content widths inside Gutenberg so editorial content never clashes with your frontend CSS:
{
"$schema": "https://schemas.wp.org/wp/6.6/theme.json",
"version": 3,
"settings": {
"layout": {
"contentSize": "760px",
"wideSize": "1200px"
},
"color": {
"palette": [
{ "slug": "primary", "color": "#2563EB", "name": "Brand Primary" },
{ "slug": "dark", "color": "#0F172A", "name": "Surface Dark" }
]
}
}
}
Step 3: Isolate Optional Modules & Companion Plugins
Keep functions.php short and readable by placing Customizer controls inside inc/customizer.php and HTTP/REST security filters inside inc/security.php. When adding Custom Post Types or custom Elementor widgets that hold client content or business data, ship them in a site-specific companion plugin inside /wp-content/plugins/ rather than locking them inside the theme.
Step 4: Generate & Validate the Package Before Launch
You can assemble this entire folder structure—complete with matching prefixes, PHP 8.1–8.3 headers, optional WooCommerce hooks, and theme.json—in seconds using our WordPress Starter Theme ZIP Generator, then verify your manifest with our style.css & Screenshot Validator.
Pre-Launch Checks for a WordPress Starter Theme with theme.json
Before deploying a lightweight WordPress Starter Theme with theme.json to production hosting, verify that editor palettes render identically in the block canvas and frontend styles, test responsive breakpoints across desktop and mobile viewports, and confirm every enqueued asset passes WordPress version caching.
- Typography & Spacing Tokens: Define consistent
fontFamiliesand container widths insidetheme.jsonso new authors never break editorial line length. - Clean Fallback Templates: Verify
archive.php,search.php, and404.phpinherit shared spacing and typography from your starter stylesheet.
Frequently Asked Questions
Does adding theme.json convert my classic PHP theme into a block theme?
No. WordPress only treats a theme as a Full Site Editing (FSE) block theme when templates/index.html exists; classic PHP themes use theme.json cleanly to supply editor palettes, spacing, and typography presets.
Why should starter themes avoid bundling jQuery globally?
Unless a specific plugin or interactive library explicitly declares jquery as a dependency, modern vanilla ES6+ JavaScript handles navigation toggles, tabs, and fetch requests with smaller payloads and zero render blocking.
Where should comments.php or searchform.php go if customized?
WordPress falls back to built-in core markup when single.php calls comments_template() or 404.php calls get_search_form(), and automatically uses your theme’s custom comments.php or searchform.php whenever you add them to the theme root.
Pair your starter theme with clean script loading from the Enqueue Generator, add baseline protection via the Security Snippet Generator, or follow our end-to-end HTML to WordPress Conversion Guide.