Search by

concept-image / wp-starter-theme

concept-image

Base theme setup for WordPress with custom hooks and templates for Concept Image. Optimized for Roots Acorn.

Package info

gitlab.com/concept-image-public/wp-starter-theme

Issues

pkg:composer/concept-image/wp-starter-theme

Statistics

Installs: 2 736

Dependents: 0

Suggesters: 0

Stars: 0

6.15.0 2026-12-04 13:48 UTC

README

WP Starter Theme

Acorn foundation for Concept Image WordPress themes

concept-image/wp-starter-theme is the base of every Concept Image theme built on Bedrock + Roots Acorn (Sage). It ships:

  • hook modules that set up and clean WordPress (admin, assets, comments/search/REST, medias, e-mails, Gravity Forms, ACF, TinyMCE, SEO/robots.txt, WP Rocket), with config switches for optional behaviors;
  • custom Blade directives (@filled, @woopage, @wpauth…);
  • a theme scaffold (views, components, config, Vite + Tailwind setup) published once into your theme;
  • the mandatory Concept Image packages (blocks, custom post types, header/footer, query, roles, SMTP, cron, AJAX…);
  • Claude Code files (skills, rules, a project CLAUDE.md) for the Concept Image packages, published into your project by wp acorn starter:ai.

Requirements

  • PHP 8.4+ (required by wp-query 1.0 and wp-custom-post-types 4.2)
  • WordPress 6.5+ (script modules)
  • Roots Acorn 6.4+
  • Gravity Forms 3.0+ if used (native <button> submit)

Installing this package also installs concept-image/wp-fortress (security) and concept-image/wp-hook-attributes, plus concept-image/wp-ajax (^0.2: AJAX actions declared with #[Ajax] on the theme's app/Actions classes, nonce, access and throttle checked, Alpine client published by wp acorn ajax:install), concept-image/wp-archive-base (^4.0: archive and filter UI, <x-archive.*> / <x-filter.*> Tailwind + Alpine components published into the theme by wp acorn archive:install, fed by the wp-query filters of archiveQuery() through ArchiveData, AJAX through a generated Filter{Type} action), wp-base-nav, wp-blocks, wp-core-ui, wp-cron (^3.1: recurring tasks declared with #[Schedule] on the theme's app/Actions classes or Hooks methods, wp acorn cron:sync), wp-custom-post-types (^4.2: archive queries declared on the post type class, opted in with implements HasArchiveQuery (archiveQuery(), per page in protected static int $postsPerPage), read with X::archive()), wp-footer-base, wp-header, wp-query (^1.2: fluent WP_Query builder, X::query(), eager loading for cards, filters with ranges, dates and counts, pagination), wp-roles (^3.0: roles from the theme's config/roles.php, applied with wp acorn roles:update), wp-smtp (^3.0: mail transport per environment from .env, Mailpit in development, Ethereal in staging, a real SMTP server in production, wp acorn smtp:status / smtp:test) and log1x/acf-composer. Don't require them again in the theme. The generators concept-image/wp-make-block (blocks), concept-image/wp-make-cpt (post types and taxonomies, ^3.0) and concept-image/wp-acorn-stubs (^2.0: make:hooks, make:ajax, make:schedule, make:service, make:action, make:helper, make:value-object) go in the theme's require-dev.

Installation

From the theme directory:

composer require concept-image/wp-starter-theme

A theme composer.json then only needs:

"require": {
    "php": ">=8.3",
    "concept-image/wp-starter-theme": "^6.0",
    "roots/acorn": "^6.1"
}

The service provider is auto-discovered by Acorn.

Publishing

# Everything at once, from the Bedrock root: scaffold, core components, AJAX client, archive components, Claude Code
# files (existing files kept)
wp acorn starter:install

starter:install runs the five steps below; run them on their own when needed:

# Theme scaffold (views, components, config, Vite setup). Existing files are kept unless --force.
wp acorn vendor:publish --tag="wp-starter-theme"

# Core components <x-core.*> (concept-image/wp-core-ui), missing ones only
wp acorn core-ui:install

# AJAX Alpine client (concept-image/wp-ajax) → resources/scripts/ajax, @alpinejs/morph in package.json.
# Add the lines it prints to resources/scripts/main.ts, then npm install
wp acorn ajax:install

# Archive and filter components (concept-image/wp-archive-base), default set, and their client → resources/scripts/archive.
# Add the lines it prints to resources/scripts/main.ts; `wp acorn archive:clean` drops the unused ones before delivery
wp acorn archive:install

# Claude Code skills, rules and CLAUDE.md → <bedrock root> (re-run with --force after updates)
wp acorn starter:ai

The scaffold is published once: it then belongs to the project. Package updates never modify it; compare with vendor/concept-image/wp-starter-theme/theme when upgrading.

Architecture

ConceptImageWpStarterThemeServiceProvider registers each module as a singleton, then HookRegistrar (concept-image/wp-hook-attributes) reads its PHP attributes and wires them into WordPress:

#[Action('admin_menu')]
#[WhenConfig('theme.disable.comments')]   // registered only when the config value is truthy
public function removeCommentsMenu(): void { … }
  • #[Action(hook, priority)] / #[Filter(hook, priority)] (from concept-image/wp-hook-attributes): repeatable; accepted arguments come from the method signature.
  • #[WhenConfig(key, default, equals)]: on a class or a method; skips the hooks when the condition fails.
ModuleClassWhat it does
Theme setupHooks\ThemeSetupText domain, editor-styles, theme.menus.
ACFHooks\ACFLink fields store the target post ID (url_post_id) so URLs follow slug/parent changes (query string and #fragment kept); fields named form list Gravity Forms.
AdminHooks\AdminHides core update notices, Tools and Themes for non-admins; removes Site Editor/Customizer entries; footer credit; login logo → home.
AssetsHooks\AssetsVite styles/scripts (front, block editor, login), modulepreload, via Services\AssetsService.
jQueryHooks\JqueryFront-end jQuery: removal, Gravity Forms exception, opt-in CDN + SRI.
BladeServices\BladeServiceCustom Blade directives.
HeadHooks\Head<head> cleanup (legacy links, generator, emoji, REST/oEmbed discovery).
oEmbedHooks\OembedoEmbed discovery, route and embed rewrite rules removed (disable.remove_json_api).
Block libraryHooks\BlockLibraryCore block assets, block templates and patterns (disable.core_blocks).
CommentsHooks\CommentsComments and pings disabled everywhere (disable.comments).
Default post typeHooks\DefaultPostType"Posts" menu, "+ New post", Quick Draft widget (disable.default_post_type).
SearchHooks\SearchFront-end search → 404, form and widget removed (disable.search).
HeartbeatHooks\HeartbeatRemoved in development, slowed elsewhere (heartbeat.*).
Gravity FormsHooks\GravityFormDecoded subjects, default notification address, CSS removal, login to download uploads, no required legend.
MediasHooks\MediasImage sizes, upload size limits, no sizes="auto".
NotificationsHooks\NotificationsNo admin e-mails for new users/password resets; no update success e-mails (SMTP transport, sender and envelope Sender: wp-smtp).
PerformanceHooks\PerformanceWP Rocket preload tuning (theme.rocket).
SEOHooks\SEOtitle-tag support, robots.txt (Builders\RobotsTxtBuilder), Yoast metabox at the bottom.
TinyMCEHooks\TinyMCEtheme.tiny_mce formats/toolbars, no custom color picker.

Hooks in your theme

Themes use the same attributes. Write hook classes in app/Hooks and list them in the stub ThemeServiceProvider:

protected array $hooks = [
    \App\Hooks\ShopArchiveSlug::class,
];

public function boot()
{
    foreach ($this->hooks as $hooks) {
        HookRegistrar::register($this->app->make($hooks));
    }

    parent::boot();
}

Full theme conventions (Hooks, Services, Blade components, queries and performance, assets) are in the Claude skill: resources/claude/skills/wp-starter-theme/references/theme-development.md (published to .claude/skills/wp-starter-theme/ in projects).

Modules are always active: they are the base every project relies on. Only optional behaviors have a config switch (comments, search, REST, core blocks, default post type, Heartbeat, Gravity Forms CSS, title-tag, WP Rocket tuning), declared with #[WhenConfig] on the hook method. Change them in config, never with remove_filter(): hook method names are not a stable API.

Configuration

config/theme.php

KeyDefaultDescription
menus4 menusregister_nav_menus() locations.
images.sizes_to_remove['1536x1536', '2048x2048']Core sizes removed.
images.sizes_to_add[]['name', 'width', 'height', 'crop'] entries.
tiny_mce.configformats…Merged into TinyMCE init (arrays JSON-encoded).
tiny_mce.toolbarsCouleurACF WYSIWYG toolbars.
disable.commentstrueComments closed, hidden and removed from the admin.
disable.searchtrueFront-end searches return 404; search form/widget removed (admin searches untouched).
disable.remove_json_apitrueRemoves oEmbed discovery, route and embed rewrite rules (flush permalinks after toggling).
disable.core_blockstrueDequeues block library/global styles, disables block templates and core patterns.
disable.default_post_typetrueHides the "Posts" menu and "+ New post".
heartbeat.disable_in_developmenttrueRemoves Heartbeat in development.
heartbeat.interval120Heartbeat interval (15–120 s) elsewhere; skipped when WP Rocket controls Heartbeat; 0 = core default.
uploads.max_size.image / docs / video3 / 5 / 100 (the stub reads env IMAGE_/DOCS_/VIDEO_MAX_UPLOAD_MO_SIZE)Max upload size in MB per MIME family (image/font, text/application/audio, video).
gravity_forms.disable_csstrueRemoves all Gravity Forms stylesheets.
gravity_forms.default_addressenv GRAVITY_FORMS_DEFAULT_ADDRESSReplaces {admin_email} notification recipients.
supports.breadcrumbstrueEnables the Yoast breadcrumb component.
textdomainci-replaceTheme text domain (resources/lang).
preprod_allowed_user_agents[]Crawlers still allowed when the site is not public.
rocket.rocket_change_parameterstrueApplies the rocket.* WP Rocket preload values.
seo.title_tagtrueAdds title-tag support: WordPress/Yoast print <title>, layouts must not print their own.
seo.crawl_delay0Crawl-delay in robots.txt (ignored by Google).

__() calls in config files run before the theme text domain is loaded (and are frozen by config:cache): they only use the default domain.

config/assets.php

KeyDefaultDescription
styles_path / scripts_pathresources/styles/ / resources/scripts/Prefix passed to Vite::asset().
front_styles / front_scriptsmainMap of main, front-page or a page template file (template-x.blade.php) → file or list of files. First match wins: front page, page template, then main.
editor_style['editor.css']Block editor stylesheets.
login_stylelogin.cssLogin page stylesheet.
disable_jquerytrueRemoves jQuery from the front-end (never the admin). Scripts depending on jquery are dropped too.
import_jquery_with_gravity_formstrueLoads jQuery anyway when a Gravity Form is rendered.
jquery_urlnullnull = WordPress' bundled jQuery. A URL opts in to a CDN build.
jquery_integritynullSRI hash (sha384-…) added to the CDN jQuery tag.
vite_clientfrom VITE_HOST/VITE_PORTVite client loaded in development (WP_ENV=development).

Handles: the first file of a group is ci_main (front), admin_main (editor), ci_login (login); next files get _1, _2… suffixes, or use string keys to name them.

Blade directives

DirectiveDescription
@filled($a, $b) … @elsefilled(...) … @endfilledAll arguments non-empty. Compiled to ! empty(), so undefined variables are safe. @unlessfilled also available.
@anyfilled(...)At least one argument non-empty (+ else/unless/end variants).
@notempty(...) / @notallempty(...)Aliases of @filled / @anyfilled.
@woopage … @endwoopageWooCommerce cart, checkout (incl. order received) or account page; false without WooCommerce.
@wpauth / @wpguestLogged-in visitor / guest.
@wpguardexit when ABSPATH is not defined.

robots.txt

  • Site not public (blog_public off, e.g. pre-production): everything is disallowed, except preprod_allowed_user_agents.
  • Public site: core rules, plus Disallow on feeds, trackbacks, the content directory, Gravity Forms uploads, wp-includes, wp-admin, wp-login.php, xmlrpc.php and *.php|inc|zip|gz|log|ini|po|cgi files; then Allow on CSS, JS, images and videos in the content directory. Paths come from the install (Bedrock: /app/, /wp/wp-includes/…). The admin-ajax.php allow line is removed.

Other uploads (PDF, documents…) in the content directory are not crawlable.

Theme scaffold

Published into the theme by the wp-starter-theme tag:

  • app/: setup.php, filters.php, helpers.php, Providers/ThemeServiceProvider, Options/GeneralOptions (ACF Composer option page), View components.
  • config/: theme.php, assets.php, acf.php, cache.php.
  • resources/views: layout (skip links + <main id="content">), page, front-page, 404, template-sitemap (HTML sitemap excluding Yoast noindex posts), template-redirect (redirects to the first published child page).
  • Components: <x-layouts.sitemap> (the others are core components, below).
  • vite.config.js, package.json, Tailwind CSS 4 styles (including the design tokens of the core components), TypeScript entry.

The core components (<x-core.section>, <x-core.container>, <x-core.heading>, <x-core.image>, <x-core.figure>, <x-core.button>, <x-core.wysiwyg>, <x-core.breadcrumb>, <x-core.favicon>, <x-core.skip-links>) are not part of the scaffold: they come from concept-image/wp-core-ui, required by this package. wp acorn core-ui:install publishes the missing ones into the theme (app/View/Components/Core, resources/views/components/core), where they belong to the project; wp acorn core-ui:clean deletes the ones the theme doesn't use (--dry-run lists them, core-ui:install restores them). The scaffold keeps what they rely on: the tokens (theme.css), utilities.css, the hocus variant (variant.css), components/wysiwyg.css, components/breadcrumb.css, the @filled directive and public/favicon/.

Image component

<x-core.image :image="$imageId" size="medium_large" />
<x-core.image :image="$image" width="800" height="600" cover />
<x-core.image :image="$imageId" eager />          {{-- loading=eager, fetchpriority=high --}}
<x-core.image :image="$imageId" :customsrcset="[['medium', '600w'], ['large', '1200w']]" />

Wraps wp_get_attachment_image(). width/height select the closest size; cover adapts to the image orientation. Images are lazy-loaded by default. alt=false forces an empty alt. See wp-core-ui's README for the other core components.

Vite

npm install
npm run dev     # dev server (HTTPS, VITE_HOST / VITE_PORT from the Bedrock .env)
npm run build   # production build in public/build

nginx

The theme sources and uploads protections are Apache .htaccess rules (wp-fortress). On nginx, deny them yourself:

location ~* ^/app/themes/[^/]+/(?!public/|style\.css$|screenshot\.png$) { deny all; }
location ~* ^/app/uploads/.*\.php$ { deny all; }

Known pitfalls

  • Any ACF field named form gets its choices replaced by the Gravity Forms list.
  • disable_jquery drops every front-end script that depends on jquery.
  • concept-image/wp-query is required as ^1.0 and concept-image/wp-custom-post-types as ^4.2: a 2.0 / 5.0 release needs a constraint bump here.
  • Without a Vite build (public/build/manifest.json) or a running dev server, pages throw ViteManifestNotFoundException.

Security

Security lives in concept-image/wp-fortress, required by this package: security headers and CSP, REST restriction, user enumeration, XML-RPC, sanitized SVG uploads, .htaccess rules (theme sources, PHP in uploads…), firewall and security maintenance. It works alongside SecuPress Pro. After installing, run wp acorn fortress:install.

Claude Code

Bedrock projects have no Laravel Boost, so the Concept Image packages publish their AI guidance straight into the Bedrock root, where Claude Code loads it on its own. One command publishes all of it:

wp acorn starter:ai           # skills, rules and CLAUDE.md; existing files are kept
wp acorn starter:ai --force   # after a package update: refresh the skills and rules (never CLAUDE.md)
PackageTagFiles (Bedrock root)
wp-starter-themewp-starter-theme-ai (wp-starter-theme-skill + wp-starter-theme-rules).claude/skills/wp-starter-theme/, .claude/rules/wp-starter-theme/
wp-acorn-stubs (when installed, dev only)wp-acorn-stubs-ai.claude/skills/wp-acorn-stubs/, .claude/rules/wp-acorn-stubs/
wp-ajaxwp-ajax-ai.claude/skills/wp-ajax/, .claude/rules/wp-ajax/
wp-archive-basewp-archive-base-ai.claude/skills/wp-archive-base/, .claude/rules/wp-archive-base/
wp-blockswp-blocks-ai.claude/skills/wp-blocks/, .claude/rules/wp-blocks/
wp-core-uiwp-core-ui-ai.claude/skills/wp-core-ui/, .claude/rules/wp-core-ui/
wp-cronwp-cron-ai.claude/skills/wp-cron/, .claude/rules/wp-cron/
wp-custom-post-typeswp-custom-post-types-ai.claude/skills/wp-custom-post-types/, .claude/rules/wp-custom-post-types/
wp-fortresswp-fortress-ai.claude/skills/wp-fortress/, .claude/rules/wp-fortress/
wp-make-block (when installed, dev only)wp-make-block-ai.claude/skills/wp-make-block/, .claude/rules/wp-make-block/
wp-make-cpt (when installed, dev only)wp-make-cpt-ai.claude/skills/wp-make-cpt/, .claude/rules/wp-make-cpt/
wp-querywp-query-ai.claude/skills/wp-query/, .claude/rules/wp-query/
wp-roleswp-roles-ai.claude/skills/wp-roles/, .claude/rules/wp-roles/
wp-smtpwp-smtp-ai.claude/skills/wp-smtp/, .claude/rules/wp-smtp/
wp-starter-themewp-starter-theme-claude-mdCLAUDE.md

A package is skipped when its provider isn't loaded (wp-make-block, wp-make-cpt and wp-acorn-stubs in production), or when the installed version has no Claude Code tag yet. The rules are loaded by path: wp-starter-theme.md always, the others for the theme's hooks and providers, components and views, config/theme.php / config/assets.php, assets and tests.

CLAUDE.md is a stub for the project: stack and skills, commands, a section for project notes, and the workflow for package bugs (fix them in the package repository, never in vendor/concept-image/*). It is published only when missing: starter:ai never overwrites it, even with --force.

Theme tests and quality tools

The scaffold publishes a test suite and quality tools into the theme: tests/, phpunit.xml.dist, pint.json, phpstan.neon.dist and an empty phpstan-baseline.neon.

The tests run against the live site and database of the current environment. There is no test database: tests are read-only (no factories, no RefreshDatabase, no writes). Run them inside the project container, where the database is reachable.

FileCovers
Feature/SmokeTest.phpFront page 200, unknown URL 404 (theme template), robots.txt; no PHP error displayed or logged by the theme; layout (<title> once, #content); every local CSS/JS asset served; no Vite dev server outside development; search 404 when disabled
Feature/PageTemplatesTest.phpEvery Blade view compiles to valid PHP; declared page templates exist; every published page (50 max) and one page per template answer 200/301/302 without PHP error
Feature/WordPressTest.phpInstalled, this theme active, Bedrock URLs and environment, pretty permalinks, static front page, ACF active, indexable only in production
Feature/SecurityTest.phpFile editing disabled, no displayed errors outside development, no guessable admin logins, theme sources / .env / composer.json not served, no directory listing, composer audit clean, no pending semver-compatible update of the theme dependencies; with wp-fortress: security headers, users hidden from guests (REST, ?author=), XML-RPC refused, fortress:htaccess --check
Feature/BrowserTest.phpNo JavaScript error on the front and 404 pages (skipped until Pest browser testing is installed)
ArchTest.phpNo debug calls; services don't register hooks; hook classes use attributes; view components extend Component

PHP errors count when they come from the theme (its code or concept-image/* packages), or when they are fatal wherever they come from. Third-party plugin notices don't fail the suite.

Setting up a new project

From the theme directory, inside the project container:

composer config allow-plugins.pestphp/pest-plugin true
composer require --dev "pestphp/pest:^4.0|^5.0" "phpstan/phpstan:^2.1" \
    "szepeviktor/phpstan-wordpress:^2.0" "php-stubs/acf-pro-stubs:^6.0"

Add these scripts to the theme composer.json:

"scripts": {
    "lint": "pint",
    "test:lint": "pint --test",
    "analyse": "phpstan analyse --memory-limit=1G",
    "analyse:baseline": "phpstan analyse --generate-baseline --memory-limit=1G",
    "test": "pest",
    "ci": ["@test:lint", "@analyse", "@test"]
}

Publish the scaffold, the core components and the Claude Code files first, from the Bedrock root:

wp acorn starter:install    # vendor:publish --tag=wp-starter-theme, core-ui:install, ajax:install, archive:install, starter:ai

Then, once all packages have published their files:

composer lint               # format the published code once (Pint, Laravel preset)
composer analyse:baseline   # record the existing PHPStan issues of code published by other packages
composer ci                 # Pint, PHPStan level 5, Pest: green

Notes:

  • vendor:publish --tag=wp-starter-theme --force also overwrites phpstan-baseline.neon with the empty one: run composer analyse:baseline again after a forced publish.
  • The Bedrock root pint.json (PER preset) must exclude the theme (web/app/themes/<theme>); otherwise both configurations reformat the same files back and forth.
  • The bootstrap (tests/bootstrap.php) loads Bedrock's autoloader before the theme's, as in production. That way the root's own Pest/PHPUnit never shadows the theme's.
  • JavaScript errors: composer require --dev pestphp/pest-plugin-browser, npm install --save-dev playwright && npx playwright install chromium. The container also needs Chromium's system libraries (npx playwright install-deps, as root, in the Docker image).

Development

composer install
composer lint        # Pint (fix)
composer test:lint   # Pint (check)
composer analyse     # Larastan + WordPress stubs, level 5
composer test        # Pest
composer ci          # the three checks

The tools need PHP 8.3+ with the dom, xml and mbstring extensions. Without them, run them in Docker:

docker run --rm -u "$(id -u):$(id -g)" -v "$PWD":/app -w /app composer:2 composer ci
  • Tests run on Testbench (Laravel container, config, Blade) with Brain Monkey for WordPress functions and hooks (add_action/add_filter expectations, Functions\when() stubs). WordPress core classes (WP_Query, WP_Error, WP_Admin_Bar) and plugin APIs (Gravity Forms, WP Rocket) are stubbed in tests/Stubs. Use stubWp(['function' => $return]) and setEnvironment('production') from tests/Pest.php.
  • PHPStan reads the WordPress stubs without executing them (they would redeclare Laravel's __()), plus tests/Stubs/plugins.php and tests/Stubs/woocommerce.stub.php for plugin APIs.
  • Arch tests enforce strict types, final hook modules, the Hook contract, and no hook registration in services.

Upgrading

Migrating a project from 5.x? Follow UPGRADE.md.

Changelog

Please refer to CHANGELOG for more information.

Contributing

Please refer to CONTRIBUTING for more information.

License

Please refer to LICENSE for more information.

Credits