Add widgets to custom WordPress sidebars on theme activation?

I’m working on a WordPress 3.0 multi-site installation. Each new blog will use the same theme with slight modifications (a custom Thesis install, if it matters). I’m trying to automate the set-up process for each new blog as much as possible.

To that end, I’d like to automatically add widgets to my custom sidebars and widget-enabled footers. It’d be even better if the widgets could have pre-set parameters/content, that I or the blog owner could then go into the Widgets panel and edit.

Read More

I’ve searched high and low and haven’t been able to figure out a way to make this work.

Related posts

Leave a Reply

1 comment

  1. I have been able to do this by working with schema.php. You can find this file by locating it in wp-admin/includes/schema.php. In this file you will find all the database rows which are installed during installation. Therefore this is a 3-step process.

    1)First install one completely correct. Then look at your database and find the rows that it creates. Usually these will be created in the _options table. Then find the schema.php file and scroll to line 320
    // 3.0
    'page_for_posts' => 0,
    'page_on_front' => 0,

    2)Follow the same syntax or your entire installation will crash. Then just copy paste from your _options table. The syntax is as follows: page_for_posts=”option_name” and 0=”option_value”.

    When you are finished matching all your new rows in the schema.php install a new site. The new site will automatically install all your new rows into the database.

    3)(This applies if you are using plugins)Finally, when you are sure you have all the plugins you need. Go back to schema.php and find row 238 'active_plugins' => array(), change array(), to -> (copy and paste row “active_plugins” – the option_value’ part)

    Therefore all your plugins will be installed instantly when your sites are created.

    To summarize…1)finish one site completely 2)Find your new database rows 3)edit schema.php and upgrade.php correctly 4)install a new site.

    ******as always make sure you backup your site and always TEST TEST TEST

    Let me know if this is confusing. I use it for my job and it took me a couple weeks of discover to get this working perfectly. If you have more question and you want to ask me directly you can email me. Look at my bio.

    EDIT: You also can automate posts and pages through wp-admin/include/upgrade.php – this way you can install your widgets/widget code on install as well 🙂