Adding a setting, a pattern or a hook
Included in Free
A Customizer setting
Section titled “A Customizer setting”- Add the field in the matching file under
inc/Customizer_Settings/Fields/with\KnowX\KnowX\Customizer_Framework\Field::add( $type, $args ). The arguments aresettings(the id),label,description,section,defaultand, for a field that changes the page,outputortransport. The type picks the sanitiser:switchbecomes 0 or 1,numberan integer,colora hex colour. - If the field needs a new section, register it in
inc/Customizer_Settings/Component.phpwithSection::add(). Keep a section short; the labels and the description are what an owner reads. - Read the value with
knowx_mod( 'your_id' ). It returns the saved value or the field’s default. Test a switch withknowx_is_truthy(). - A colour belongs in
Tokens\Component(VARIABLESfor a plain mapping,build_css()for derived values) so the front end, the editor and the live preview all get it. Add the setting id to the list inaction_customize_register()so the preview updates without a reload. - Add the setting to the cases in
tests/docker/settings_qa.py, run it, and regeneratedocs/customizer-inventory.md.
A block pattern
Section titled “A block pattern”- Create
patterns/your-pattern.php. The header isTitle,Slug: knowx/your-pattern,Description,Categories: knowx-docsandKeywords. - Write the block markup. Every visible string goes through
esc_html_e()or__()with theknowxtext domain. Block attributes that contain text (a placeholder, a button label) are built withwp_json_encode()and__()in a PHP block above the markup. - Use the colour tokens and the
is-style-knowx-*group styles; do not write colours in the markup. Keep headings below the page title: start at level 2. - WordPress caches the theme’s pattern list. After you add a file run
wp_get_theme()->delete_pattern_cache()(orwp eval 'wp_get_theme()->delete_pattern_cache();'). - List the pattern in Block patterns and regenerate
audit/manifest.json.
A hook
Section titled “A hook”- Fire it with
apply_filters( 'knowx_name', $value, ... )ordo_action( 'knowx_name', ... ). Put a docblock right above the call: one sentence and a@paramline for each argument. - Add a row to the hooks reference with the default value.
- Regenerate
audit/manifest.jsonwithpython3 tools/build-manifest.py.
A stylesheet rule
Section titled “A stylesheet rule”Use the tokens in assets/css/src/_custom-properties.css (colours, --radius-*, --shadow-*, --z-*). Write logical properties (margin-inline-start, inset-inline-end) so right-to-left needs no extra rules, and add a @media rule for 390 px in the same change. Run npm run build; the .min.css files are committed.

