This is a lightweight starter theme for WordPress block themes. It provides the minimal structure to get a modern full-site editing theme up and running, while also being easy to extend.
- Fast setup for new WordPress engineers
- Clear convention-based project structure
- Build on WordPress block theme best practices
- Keep PHP logic minimal and isolated in
src/
assets/: theme asset source files (CSS, JS, fonts, images)blocks/: custom blocksparts/: reusable theme parts for header, footer, etc.patterns/: block pattern PHP registration / markupsrc/: PHP classes for theme setup, block registration, asset loadingtemplates/: full-site editing template files
Comprehensive developer guide:
- Architecture
- Build tools
- WordPress connections
- Blocks
- Templates
- Runtime behavior
This is a full-site block theme built using:
- WordPress block theme system (
theme.json, template files, template parts) - 10up toolkit (
10up-toolkit) for asset bundling, linting, testing - 10up framework (
10up/wp-framework) for modular PHP class loading - Modern CSS and JS modules in
assets/ - Custom blocks under
blocks/
Main root files:
style.css- WordPress theme header and bare stylesheet.theme.json- block theme settings, styles, color/spacing scales, templates.functions.php- Bootstrap: constants, composer loading, fast-refresh and theme setup.composer.json- PHP dependencies and PSR-4 autoload.package.json- JS/asset build and 10up-toolkit configuration.
- PHP >= 8.2
- Node >= 18
- Composer
- WordPress 6.8+ (implied by theme.json schema)
- Clone the repository:
git clone <repo-url> 10up-block-theme cd 10up-block-theme
- Install dependencies:
composer install npm install
- Build assets:
npm run build
- Activate theme in WordPress admin: Appearance → Themes → "10up Block Theme"
cd /path/to/themes/10up-block-theme
composer install
npm install
npm run buildnpm run watch(ornpm start) → 10up-toolkit watch with HMR/hot-refreshcomposer exec phpcs -- --standard=WordPress→ PHP lintnpm run lint→ JS lintnpm run lint-style→ CSS lintnpm run test→ unit testsnpm run clean-dist→ remove generated assets
- Always build
dist/after changing source assets (assets/,blocks/,src/). - If using a check-in strategy for
dist/, ensure CI runsnpm run buildbefore release. theme.jsonis the source of truth for editor styles, palette, and layout. Adjust there for global styles.- Some references may still use legacy naming in older helper docs; prefer 10up-block-theme naming in code changes.
- defines constants:
TENUP_BLOCK_THEME_PATH,TENUP_BLOCK_THEME_DIST_PATH,TENUP_BLOCK_THEME_INC, etc.
- points to composer/autoload (
vendor/autoload.php) - local fast-refresh via
dist/fast-refresh.phpwhen local environment - includes helper files:
includes/helpers.phptemplate-tags.php
- creates and sets up
\TenupBlockTheme\ThemeCore.
- hooks:
init→ThemeCore::init()after_setup_theme→i18n()+theme_setup()wp_head→js_detection()+scrollbar_detection()
init()ensuresTenupFramework\ModuleInitializationexists, admin notice on failureModuleInitialization::instance()->init_classes( TENUP_BLOCK_THEME_INC )automatically loads modules fromsrc/.
By ThemeCore::init(), \TenupFramework\ModuleInitialization scans src/ and initializes modules that implement ModuleInterface.
Current modules:
src/Blocks.php(block registration and enqueueing)src/Overrides.php(WP output filters such as post date text for custom post types)src/TemplateTags.php(meta tag injection onwp_head)
Each module uses TenupFramework\Module trait to register hooks easily.
register_theme_blocks()scansdist/blocks/*/block.jsonand callsregister_block_type_from_metadata()for each found block.allowed_block_types_allfilter extends allowed blocks with theme blocks.enqueue_theme_block_styles()scansdist/blocks/autoenqueue/**/*.cssand registers/enqueues style/script for each block with assets info fromGetAssetInfo.- includes block render filter for TenUp navigation block (removes ARIA roles for fallback markup compatibility).
blocks/ contains block sources with standard WP block scaffold:
block.jsonedit.tsx,index.ts,markup.phpstyle.css/editor.css(for block styles)
blocks/* are transpiled and bundled by 10up-toolkit into dist/blocks/* (JS/CSS/asset metadata files).
package.json includes a 10up-toolkit config section:
useBlockAssets: true (auto-handle block assets)useScriptModules: trueloadBlockSpecificStyles: trueentrymaps compiled assets:editor-style-overrides:assets/css/editor-style-overrides.cssfrontend:assets/js/frontend.tsblock-extensions:assets/js/block-editor/index.ts
paths.blocksDir:./blocks
npm run build calls 10up-toolkit build and outputs to dist/*.
npm run watch does incremental build with file watching.
dist/css/(compiled styles)dist/js/(compiled scripts)dist/blocks/(compiled block assets per block)dist/fast-refresh.php(local live-reload helper)
src/ThemeCore::theme_setup()callsadd_theme_support('editor-styles')andadd_editor_style('/dist/css/frontend.css').- Additional frontend script injection is likely handled in block metadata and
10up-toolkitoutput, not explicit in theme code.
Defines:
templateParts:header,footercustomTemplatesfor special post typessettingswith custom properties (--wp--custom--*, width computations, spacing, color palettes, gradients, transition variables)layoutwith content and wide max widths.
editor-style-overrides.cssfor editor-specific style overridesfrontend.cssfor visual styles- subdirectories for base/blocks/components/globals/mixins/patterns/templates/utilities
parts/header.html,parts/footer.html, etc.
- e.g.,
base-card.php, etc.
templates/ uses static HTML templates for site result paths:
index.html,home.html,single.html, etc.
These are block theme templates in Full Site Editing model.
-
wp_head:ThemeCore::js_detection()togglesno-jstojsThemeCore::scrollbar_detection()sets--wp--custom--scrollbar-widthTemplateTags::add_viewport_meta_tag()outputs viewport meta
-
after_setup_theme: editor styles + disable core block patterns. -
init: loads module classes and runs block registration.
- local environment scenario (
.local/.testorlocal/development) loadsdist/fast-refresh.phpand sets dist URL path withTenUpToolkit\set_dist_url_path()for hot-reload.
- Add block in
blocks/<block-name>/. - Create
block.json,edit.tsx,index.ts, style files as needed. - Run
npm run build. - Block registers automatically from
dist/blocks/*inBlocks::register_theme_blocks().
- PHP lint:
composer exec phpcs -- --standard=WordPress - JS lint:
npm run lint/npm run lint-js - Style lint:
npm run lint-style - Format JS:
npm run format-js - Clean dist:
npm run clean-dist
functions.php→ThemeCore→ class loadersrc/Blocks.php→ block metadata and enqueueingassets/js/frontend.ts→ frontend script implementationblocks/*+10up-toolkit→dist/blocks/*theme.json→ WordPress UI/Editor settings
composer installnpm installnpm run watchnpm run buildcomposer exec phpcs -- --standard=WordPressnpm testnpm run lint
- This theme is designed around a 10up block theme pattern (colors, spacing, utilities, templates).
- The 10up Toolkit plus the WP framework yields a highly modular, maintainable code path and is production-ready.