[WordPress] Change the default theme for sites without a plugin

There’s a new and very little documented feature in 3.0 for changing the default theme. And? This will work on single WordPress installs as well as being handy for a network of sites.

The magic line is this in your config file:

define('WP_DEFAULT_THEME', 'theme-folder-name');

In this example, the classic theme is used as the default when a site is created, or when a theme in use is removed. If you are starting fresh with 3.0, the default is the new TwentyTen, so this override is handy.

Added tip: if you have a lot of blogs using the Kubrick theme and wanted to remove it and set the other blogs, do this define first with your new default theme, then remove or rename the Kubrick theme folder (in my it was simply “default”). On a refresh, all blogs using the Kubrick theme will be switched to your new default.

If you just wanted the Kubrick theme to go away and have twentyten show up, you won’t need to do the define above. Just rename the /default/ theme folder. It’ll kick in.

(thanks to Ron for reminding me & MichaelH for the codex note I missed)

EDIT: if you are setting a CHILD THEME as the default, you’ll get some errors. Place this line in your wp-config.php file as well, right under the line I gave above.
define( 'TEMPLATEPATH', '/path/to/themes/folder/name-of-parent-theme');

Further amendment: if you really want a child theme set as default, but still have the ability to switch to other theme (standalone or child of another parent) then you will HAVE TO use a plugin to set the default theme.



Share this Post :

No comments yet.

Please Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *