I want to assign default sidebar widgets for all new blogs. I am able to assign sidebar widgets to the left, center and right sidebars using a new file I called sidebarwidgets.php in the wp-content/mu-plugins directory. The code for in sidebarwidgets.php is:
<?php
function new_blogs_setting( $blog_id ) {
add_option( ‘widget_categories’,
array( ‘title’ => ‘My Categories’ ));
add_option(“sidebars_widgets”,
array(“sidebar-1” => array(“recent-posts”:wink:,
“sidebar-2” => array(“categories”, “tag_cloud”:wink:,
“sidebar-3” => array(“pages”, “links”:wink:));
}
add_action(‘populate_options’, ‘new_blogs_setting’:wink:;
?>
This works great and the setting is applied to all NEW blogs created after uploading sidebarwidgets.php. However, I can’t figure out how to create a default setting for the blog sidebar (sidebar-4). When I put in code with a similar syntax pointing to the unused “archives” widget it causes the whole site to white screen. In the interim, users see a message asking them to add a widget to the blog sidebar, so they would have to add that manually.
I am no programmer, so I am hoping someone wiser than I might be able to point me in the right direction. This be a great plug-in with a little modification. For now, I’m just frustrated. Thanks!