Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Member pages all the same widgets


John James Jacoby
Keymaster

@johnjamesjacoby

As an example of how to hook into the existing WordPress functions, make a file called something like “new-blog-defaults.php” and put it in your WPMU directory. (You can name this whatever you’d like.)

Inside that file, put…

function nbd_widgets()  {
// You need to know the names of the sidebar(s) and widget(s) you want to add.
// This example inserts Categories and Tag Cloud widgets into the "blog-sidebar" Sidebar

add_option( 'widget_categories',
array( 'title' => 'My Categories' ));
add_option("sidebars_widgets",
array("blog-sidebar" => array("categories", "tag_cloud")));
}
add_action('populate_options', 'nbd_widgets');

The last line is where this function actually gets called. It automatically hooks itself into the existing “populate_options” function that WordPress calls when a blog is created. You can use the “wpmu_new_blog” function to perform other similar actions.

Skip to toolbar