Configure T2
Configure which blocks and extensions are enabled in your WordPress project using a single configuration file.
Overview
The T2 Config package provides a unified way to manage which blocks and extensions are loaded in your WordPress environment.
Configuration is handled via a t2.json
file placed in your theme.
t2.json
Example {
"version": 1,
"mu-blocks": ["t2/accordion"],
"mu-extensions": ["t2/button-icon"]
}
How It Works
This package reads your t2.json
file and registers the specified blocks and extensions automatically.
This allows for easy, code-free configuration of your site's functionality.
- Place your
t2.json
in the root of your theme. - On load, the config package will parse this file and enable the listed blocks and extensions.
Properties (t2.json)
is-multisite
booleanIs current installation a multisite?
Define if T2 admin api should be loaded
Define if T2 blocks api should be loaded
Define if T2 extensions api should be loaded
mu-blocks
string[]Define must use blocks
mu-extensions
string[]Define must use extensions
include-blocks
arrayIncluded blocks. Restrict the T2 blocks that can be enabled. Empty array to allow all.
exclude-blocks
arrayExcluded blocks. Restrict the T2 blocks that can be enabled. Empty array to allow all.
include-extensions
arrayIncluded extensions. Restrict the T2 extensions that can be enabled. Empty array to allow all.
exclude-extensions
arrayExcluded extensions. Restrict the T2 extensions that can be enabled. Empty array to allow all.
Hooks
config/src/config.php
Inherit config from parent theme
apply_filters( 't2/config/inherit_from_parent', bool $should_inherit )
Parameter | Type | Description |
---|---|---|
$should_inherit |
bool |
Whether to inherit config from parent theme. Default true. |
Filters the T2 config
apply_filters( 't2/config', array $config )
Parameter | Type | Description |
---|---|---|
$config |
array |
T2 config. |