ChildTheme

Class.

use Saij\WpAppFramework\ChildTheme;

Boots the framework for an active child theme with code of its own and provides its paths.

A child theme with blocks, hooks or routes is a framework instance of its own: its slug is get_stylesheet(), its release prefixes its own copy of the framework, and it talks to its parent theme only through the public API (#[ThemeApi]) and public template callables of the parent. A child theme that only overrides templates of its parent (overrides/{parent}/) needs no boot and no build.

The instance is created only by boot() and handed to the container as a predefined instance: services of the child theme can inject it.

Methods

boot()

ChildTheme::boot(): void

Boots the framework. Called once from the child theme's functions.php, which WordPress loads before the parent theme's.

Release mode applies if the child theme contains generated/manifest.php (created only by the release build). Caches live in wp-content/cache/{stylesheet}. Templates are looked up in the child theme's src/, then in the framework. At its end, boot() fires the action wp_app_framework/init/{stylesheet}.

getDirectory()

getDirectory(): string

Directory of the child theme, as returned by get_stylesheet_directory().

Returns string

getDirectoryUri()

getDirectoryUri(): string

URI of the child theme directory, as returned by get_stylesheet_directory_uri().

Returns string

getFrameworkDirectory()

getFrameworkDirectory(): string

Filesystem path of the framework package; never derive URLs from it.

Returns string

getParentDirectory()

getParentDirectory(): string

Directory of the parent theme, as returned by get_template_directory().

Returns string

getParentDirectoryUri()

getParentDirectoryUri(): string

URI of the parent theme directory, as returned by get_template_directory_uri().

Returns string

getParentSlug()

getParentSlug(): string

Directory name of the parent theme (get_template()).

Returns non-empty-string

getSlug()

getSlug(): string

Directory name of the child theme (get_stylesheet()); it names everything global of the framework instance.

Returns non-empty-string