MyBB Community Forums

Full Version: Parent theme inheritance
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I've been looking, without success, for a way to inherit most of my stylesheet settings and/or template settings from a parent theme in a nice manner. What I want is basicly to have two very similar themes where one would be set as default and another one set as active within a certain category. The main thing I would change here would be a few images, some colors etc.

Preferably I'd have liked for the parent theme's stylesheet to be parsed first, with the child themes stylesheet coming after, overwriting the relevant style settings.

E.g. if I want to change the background in body {}:

body{} in parent theme is set to url('images/parenttheme/background.png'); while in the child theme it is set to url('images/childtheme/background.png');

The other properties of body aren't mentioned in the child theme's stylesheet as they shouldn't differ from the parent settings. When I edit a stylesheet now, it simply stops reading the parent stylesheet altogether and wants me to copy its code instead.

Is there a nice way to achieve this?
The easiest method I've come up with is adding a new style sheet to the child theme. Then, to ensure that it doesn't matter what order the sheets are included in, add !important to the attributes (i.e. "color: #000 !important;"). IDK if that is necessary, though.

The normal css files will still be inherited, and the subtheme-specific ones will override the normal ones.
(2011-04-28, 04:00 PM)Firestryke31 Wrote: [ -> ]The easiest method I've come up with is adding a new style sheet to the child theme. Then, to ensure that it doesn't matter what order the sheets are included in, add !important to the attributes (i.e. "color: #000 !important;"). IDK if that is necessary, though.

The normal css files will still be inherited, and the subtheme-specific ones will override the normal ones.

Thank you!