During the development of WordPress 3.0 we have made a number of changes under the hood which will be of interest to the developers and users of themes. Some of these changes are about making themes easier to develop and some of them are about making it easier to support the override of parts of themes.
The first change which should make it easier for extensible flexible theme development is the introduction of
get_template_part() which has been introduced as a generic way of modularising themes a step beyond the basic footer/body/header files. This new function makes it very easy for a theme to reuse blocks of code implementing theme areas such as the WordPress loop in a way which makes it easy for a child theme to override the implementation in a context sensitive way.
This function is really easy to use – You create a file within your theme containing the code you want to re-use and then you pull it in as follows:
get_template_part( 'loop', 'author' ); // Pull in the loop for the author archives
This will look for the files
loop.php searching first in the current themes folder before looking in the parent themes folder (if one if defined). The new TwentyTen theme in WordPress 3.0 uses this for every call to it’s
loop.php to make it easy to override in a single instance from a child theme.
The next change is to deprecate the support for overly minimal themes. Prior to WordPress 3.0 any theme which was using the relevant template tag but missing any of the following template files –
comments-popup.php – would effectively behave as if it has a parent theme defined as ‘default’ using the relevant files from the old default theme.
Now that we are moving to a new default theme we didn’t want to have to support this very old behaviour indefinitely or make it such that the files from the TwentyTen theme were used as they have a different visual layout and would like change peoples existing sites.
Going forward a WordPress theme using the relevant template tags is expected to contain all these files itself, or have them provided by a parent theme, and the theme compatibility files included in WordPress 3.0 will be removed in a future version.
If you are using a theme which is affected by this change then you just need to make sure that you have the default theme installed – it will not be in new installs but will be preserved on upgrades. Then add the following to the comment at the top of the
style.css of your theme to make it such that the default theme is used as its parent theme:
More information on the process of indicating a parent theme in a child themes
style.css is available in the codex.