Activate theme programmatically
-
Hi,
I would like to know how I can automatically activate a theme when a new blog is created in a multisite installation.
Right now I’ve got this:
add_action(‘wpmu_new_blog’, ‘create_new_site’);
function create_new_site($blog_id) {
switch_to_blog($blogid);// Do all the work
switch_theme(‘marlun’, ‘marlun’);restore_current_blog();
}My theme is located in wp-content/themes and the stylesheet is called style.css. The theme is a reworked twenty eleven. However nothing happands when a new blog is created. If I go to the apearance tab in the new blog my theme is available but not activated.
-Martin
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Activate theme programmatically’ is closed to new replies.