This documentation describes unreleased changes on the main branch.

Theme

Class.

use Saij\WpAppFramework\Theme;

Boots the framework for the active theme and provides its paths.

The instance is created only by boot() and handed to the container as a predefined instance: the container never builds it, but services of a theme can inject it to read the paths.

Methods

boot()

Theme::boot(): void

Boots the framework. Called once from the theme's functions.php.

Release mode applies if the theme contains generated/manifest.php (created only by the release build). Otherwise development mode builds the manifest by reflection and caches it in wp-content/cache/{template}/manifest. Compiled Twig templates are cached in wp-content/cache/{template}/twig, in release mode below the template version of the release. At its end, boot() fires the action wp_app_framework/init/{template}.

Templates are looked up in overrides/{template}/ of the active child theme, then in the theme's src/, then in the framework. A child theme with code of its own boots with ChildTheme::boot() instead.

getFrameworkDirectory()

getFrameworkDirectory(): string

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

Returns string

getSlug()

getSlug(): string

Slug of the theme: its directory name, as returned by get_template().

Returns string

getStylesheetDirectory()

getStylesheetDirectory(): string

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

Returns string

getStylesheetDirectoryUri()

getStylesheetDirectoryUri(): string

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

Returns string

getTemplateDirectory()

getTemplateDirectory(): string

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

Returns string

getTemplateDirectoryUri()

getTemplateDirectoryUri(): string

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

Returns string