Create a Stax child theme
A child theme keeps your code changes separate from Stax, so a theme update does not overwrite them. You need one only if you add PHP, template files or a larger stylesheet. For a few lines of CSS, Appearance > Customize > Additional CSS is enough.
Install the ready-made child theme
Section titled “Install the ready-made child theme”- Download stax-child.zip.
- Go to Appearance > Themes > Add New Theme and click Upload Theme.
- Choose the zip file and click Install Now.
- Click Activate.
The Stax theme must stay installed: the child theme loads it as its parent.
Create the child theme by hand
Section titled “Create the child theme by hand”-
On your computer, create a folder named
stax-child. -
In that folder, create a file named
style.csswith this header:/*Theme Name: Stax ChildTemplate: staxVersion: 1.0.0Text Domain: stax-child*/Template: staxis the folder name of the parent theme and must match exactly. -
Create a file named
functions.phpthat loads the child stylesheet after the theme styles:<?phpadd_action( 'wp_enqueue_scripts', 'stax_child_enqueue_styles' );function stax_child_enqueue_styles() {wp_enqueue_style('stax-child',get_stylesheet_uri(),array( 'stax-global' ),wp_get_theme()->get( 'Version' ));}stax-globalis the handle of the main Stax stylesheet, so your CSS is printed after it and can override it. -
Upload the
stax-childfolder towp-content/themesover FTP, or zip it and upload it from Appearance > Themes > Add New Theme > Upload Theme. -
Go to Appearance > Themes and click Activate on Stax Child.
Move your Customizer settings to the child theme
Section titled “Move your Customizer settings to the child theme”WordPress stores Customizer settings per theme, so a newly activated child theme starts with the default settings. To copy them over:
- Install Customizer Export/Import while the parent theme is still active.
- Export the settings from the Customizer.
- Activate the child theme and import the file.
See Export and import for the steps.
What goes in a child theme
Section titled “What goes in a child theme”- CSS: add it to the child
style.css. - PHP: add functions and hooks to the child
functions.php. It runs in addition to the parent file, not instead of it. - Templates: copy a template file from
wp-content/themes/staxto the same relative path instax-childand edit the copy. WordPress loads the child version first.