Create a Child Theme

Silverstripe Version: 4.3.1

Is it possible to create a child theme from a parent theme like “simple”? Like it is possible in Wordpress.

Definition of a child theme:
A child theme is a theme that inherits the functionality and styling of another theme, called the parent theme. Child themes are the recommended way of modifying an existing theme.

I searched on Google but didn’t find any information about creating a child theme for SilverStripe.

As of SS4 you can, the key is that you have to define the theme priority in your yml config.

The main templating docs should be here:

In particular have a look at:

1 Like

Thanks, I read the docs and I think I got it working.

  1. Copied “simple” theme renamed folder to “simple2”, modified composer.json
  2. Deleted all files from “simple2” except layout.css
  3. Changed background-color from header
  4. Modified theme.yml order:
Name: mytheme
    - 'simple2'
    - 'simple'
    - '$default'
    - '$public'

Now it seems the simple2 theme is loaded and falls back to simple if files not exist.
Is this the right way?

Looks right to me, SS will keep stepping through the list until it finds the file it needs, theoretically you can add as many themes as you want (though I haven’t tried more than 3).

One thing of note, I don’t think you need to worry about composer.json for your custom theme, I think SSViewer simply looks inside the the “themes” folder for any folders matching the list of themes you provide to it (though I could be wrong).

1 Like

You probably still do if you want to expose resources from the theme.


Alright, it’s still working fine :slight_smile: Thanks guys!

Ah yes, public folder! You probably do want to keep it then :slight_smile:

1 Like