1

If you have a sub-theme of a sub-theme...

  • Sub-theme a
  • Sub-theme b (base theme = Sub-theme a)

Ideally, what I want to do is have the default theme as 'Sub theme a' and just introduce some minor theming and processing in 'Sub theme b'. Reason being, there are lots of versions of this site being deployed and some minor fixes are required that can be thrown away at the click of a button i.e. remove Sub-theme b.

Google has not been helpful in this instance ;-)

If both themes are enabled and sub-theme a is the default, how do I get sub-theme b to work? (because its not working i.e. I have added a stylesheet in the .info file and its not being added. If I make sub-theme b default then Sub-theme a doesnt work)

  • What is effective is the default theme. Either Sub-theme a or Sub-theme b can be the default theme at any time. No need to remove anything. – Kari Kääriäinen Oct 22 '13 at 13:48
  • Sorry, I have made an edit because you made me realise I was asking this correctly, cheers. – Alex Gill Oct 22 '13 at 13:57
  • What do you mean by "it's not working"? If you set it as your theme in your profile, or with theme switcher, it fails to render? Or what are your expectations and your results? – Mołot Oct 22 '13 at 14:00
  • Ive defined a stylesheet with sub-theme b .info file and its not being added as expected. Both themes a and b are enabled and sub-theme a is default. – Alex Gill Oct 22 '13 at 14:05
  • 1
    Exactly, that's how it is supposed to work. If b is subtheme of a, and a is a subtheme of x, then when using b, you should have everything from x, overridden by things from a, overridden by things from b. Works for me. – Mołot Oct 22 '13 at 14:16
2

You always start with a base-theme. Let us call this Theme A. If you introduce a sub-theme (e.g. Theme B as a sub-theme of Theme A), it inherits everything from Theme A. You can introduce minor (or major) tweaks in Theme B.

If you set Theme B as the default, then you get Theme A + Theme B.

If you set Theme A as the default, then you get Theme A (with nothing from Theme B).

In other words, if you've set Theme A as the default, then Theme B is not supposed to work. To get Theme B to "work", you must set Theme B as the default.

This also works if you cascade with more sub-themes.

For instance, if you introduce another sub-theme (e.g. Theme C as a sub-theme of Theme B), it inherits everything from Theme A and Theme B. You can then introduce minor (or major) tweaks in Theme C.

If you set Theme C as the default, then you get Theme A + Theme B + Theme C.

A theme need to be enabled to be set as default, but works fine as an inherited theme even when it is not enabled.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.