Child theme
Included in Free
Use a child theme for any change that goes beyond the Customizer, so theme updates never overwrite your work. Everything below works the same on a site with one product or many.
Create it
Section titled “Create it”Create a folder knowx-child in wp-content/themes with two files.
style.css:
/*Theme Name: KnowX ChildTemplate: knowxVersion: 1.0.0*/functions.php:
<?phpadd_action( 'wp_enqueue_scripts', function () { wp_enqueue_style( 'knowx-child', get_stylesheet_uri(), array( 'knowx-global' ), '1.0.0' );} );Activate it under Appearance > Themes. Customizer values are stored per theme, so copy the parent’s settings to the child once (see Move the Customizer settings).
What a child theme can change
Section titled “What a child theme can change”| Goal | How |
|---|---|
| Colours, radius, shadows | Override the CSS variables in your stylesheet. See Styling, tokens and assets. |
| The markup of a page or a part | Copy the file to the same path in the child theme. See Templates and template parts. |
| Behaviour (schema, limits, palettes, breadcrumbs) | Add a filter. See the Hooks reference. |
| Content to add above or below the page | knowx_before_content, knowx_after_content, knowx_sub_header. |
| A new block pattern | Add a file to the child theme’s patterns folder. |
| A default Customizer value | Filter knowx_customizer_field_args. |
Recipes
Section titled “Recipes”Change the brand colour for the whole site
Section titled “Change the brand colour for the whole site”:root { --color-theme-primary: #0a7;}A colour set in the Customizer wins over the variable in your stylesheet, because the theme prints the owner’s choice after the defaults. Leave the Customizer Theme Color at its default if the child theme sets it.
Override one template part
Section titled “Override one template part”Copy template-parts/docs/help.php to knowx-child/template-parts/docs/help.php and change the text or markup. Keep the functions it calls. When the parent theme changes that file in an update, compare your copy against the new version: that is the price of a copy, and the reason to prefer a hook where one exists.
Add a script
Section titled “Add a script”add_action( 'wp_enqueue_scripts', function () { wp_enqueue_script( 'knowx-child-app', get_stylesheet_directory_uri() . '/app.js', array(), '1.0.0', array( 'strategy' => 'defer', 'in_footer' => true ) );} );Load a stylesheet only on docs pages
Section titled “Load a stylesheet only on docs pages”add_action( 'wp_enqueue_scripts', function () { if ( is_category() || is_singular( 'post' ) ) { wp_enqueue_style( 'knowx-child-docs', get_stylesheet_directory_uri() . '/docs.css', array( 'knowx-global' ), '1.0.0' ); }} );Move the Customizer settings to the child theme
Section titled “Move the Customizer settings to the child theme”WordPress stores Customizer values separately for each theme. After you activate the child theme, copy the parent’s values once:
wp eval 'update_option( "theme_mods_knowx-child", get_option( "theme_mods_knowx" ) );'Use your child theme’s folder name in place of knowx-child. Without a copy, every setting shows its default until you publish it again in Appearance > Customize.
Translations
Section titled “Translations”The text domain is knowx. Use it in strings that you add to copied template parts so the existing translation files keep working. The translation template is languages/knowx.pot.
Functions that changed in 2.0
Section titled “Functions that changed in 2.0”The 1.x template tag knowx_get_breadcrumb( $display = true ) still works but is deprecated: use knowx_the_breadcrumb() to print the trail. Many other 1.7 functions were internal callbacks of features that were removed in 2.0 (the login page, the plugin recommendations, the web font loader and the Kirki integration); child themes that called them directly need to drop those calls.
Before you update the parent theme
Section titled “Before you update the parent theme”- Test the update on a staging copy.
- Compare each template file you copied with the new parent file (
diffor your editor). - Check the Functions reference for any helper your child theme calls.

