I’ve written about child themes and Thesis and WPMU and Thesis before, but as can happen with time and work both Thesis and WordPress have evolved. So I think both of these issues need to be readdressed.
WordPress networks and Thesis
A WP network is the new name for WPMU since it was included with the WordPress core in WP version 3. It allows you to create multiple sites/blogs with the one WordPress install.
Thesis uses a custom folder to isolate your own CSS and PHP customisations to the theme, and it also writes the CSS from the design options to this folder (to layout.css). Prior to Thesis 1.8.3 to use Thesis with a WP network and keep the customisations for each site separate you needed to use a new Thesis folder for each site in the network (which makes updates very tedious), or modify Thesis core files to use different custom folders for each site (also not amazing for updates), or use a child theme for each site.
The child theme thing was fine with me, but now when Thesis is activated on a site in a network it gives it its own custom folder with the site’s ID. That is pretty cool, particularly since you don’t have to worry about it, and you don’t have to worry about sites changing each other’s CSS: the folders are automatically created and uniquely identified, so there’s no accidental cross-over.
An extra cool thing about this new system is that you can also use “master custom controls” on a network, so you can have PHP customisations that affect all the sites on a network by putting them in the “custom” folder of a network. That is, if you have a folder called custom in your Thesis directory, while all your sites have their own custom-ID folders, the PHP in custom/custom_functions.php will be applied to all the sites running Thesis.
Thesis and child themes
There are some other changes in Thesis, which benefit child themes and make them easier to implement.
Thesis now combines style.css and layout.css into one file (style.css gets written into layout.css and isn’t called separately). That’s great because it cuts down on the number of HTTP requests made when your site loads (always a good thing!), and it also means that the Thesis styles are always going to be loaded before your child theme style.css and custom.css (which didn’t always happen and occasionally led to oddities in CSS specificity). Also, we don’t need to call Thesis’ style.css in any way with our child theme, both it and custom.css are added to the site’s head by Thesis. That is nice: we only need to worry about adding extra stylesheets.
Thesis now (somewhere around 1.8.4 or 1.8.5) also combines child theme style.css into layout.css, so we don’t need to manually call any stylesheets! I have edited any code below accordingly.
So, to create a child theme for Thesis all we need to do is create a new theme directory containing:
- style.css containing something like this (adapted from codex.wordpress.org)
/* Theme Name: Thesis Child Theme URI: http://example.com/ Description: Child theme for the Thesis theme Author: Your name here Author URI: http://example.com/about/ Template: thesis Version: 0.1.0 */
- functions.php, which is optional in many cases, but if you want to use the Thesis Custom Loop, or add your child’s stylesheet to the head you will probably need this file and a contents of
<?php if(!is_admin()) { include_once(TEMPLATEPATH . '/functions.php'); }
- your custom folder
That’s all you need to make a basic Thesis child theme.
As with the regular Thesis custom folder, you will need to make sure that your childtheme/custom/layout.css and childtheme/custom/cache directory have permissions of 666 and 775, respectively.
You might be wondering why, with the nifty multi-directory features I mentioned above, would anyone bother with a Thesis child theme. Well, I can think of two strong reasons! One is extra page templates: it’s a lot easier to manage updates on a site with extra page templates when they’re in a child theme folder. The other reason is when you’re using a mobile theme switcher, or something similar; if you want to make significant changes to the layout of your site for mobile devices a good way to do that is with a mobile child theme.
Child themes on Networks
I discovered a little quirk in the way child themes work with Thesis 1.8.4 networks: Thesis checks the child theme directory for a custom folder and if it doesn’t find one it decides that the site specific custom folder should be created in the parent Thesis directory. So, until further notice you should just keep a folder called “custom” in your child theme directory, whether it contains custom files or not. Thesis will then proceed to create a custom-ID directory for your site specific customisations in the child theme. It’s important to pass that initial check because that will determine the location of the stylesheets that get included in the head of the site, as well as where to write the design options CSS, and which files get edited by the custom editor. I think keeping an extra custom folder in the child theme is the best way to do that, for now.