• I am making a Twentyten child theme but can’t find any info on how to set the default widgets that are displayed when a new blog is created.

    For example, how do I populate the primary-widget-area and secondary-widget-area so when a blog is created it had the widgets I want in there?

    Thanks for any help!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter jwack

    (@jwack)

    That page shows everything about widgets except for what I asked about lol

    The default sidebar content (as opposed to widgets) in within the sidebar.php template file.

    check ‘mystique’ how he has done it
    http://wordpress.org/extend/themes/mystique

    sidebar.php

    he has also integrated custom widgets,
    in /lib/widgets.php

    imho, that is quite close to using ‘real’ widgets as default code in a sidebar template.

    Thread Starter jwack

    (@jwack)

    Sorry I am confused. I see in sidebar.php that if no widgets are selected it will by default put in the static widgets listed in sidebar.php.

    But when first create a subblog it already has 5 widgets in the “Primary Widget Area”. How do I change these 5 widgets?

    In case you haven’t figured this out, all you do is drag a widget you want into the Primary widget area and save. (refresh your page)
    The hardcoded ones will be replaced by the one/ ones you dragged there.

    But when first create a subblog it already has 5 widgets in the “Primary Widget Area”. How do I change these 5 widgets?

    I think those 5 default widgets are hardcoded in wp-admin/includes/upgrade.php inside the wp_install_defaults function there is a line like this:

    update_option( 'sidebars_widgets', array ( 'wp_inactive_widgets' => array ( ), 'primary-widget-area' => array ( 0 => 'search-2', 1 => 'recent-posts-2', 2 => 'recent-comments-2', 3 => 'archives-2', 4 => 'categories-2', 5 => 'meta-2', ), 'secondary-widget-area' => array ( ), 'first-footer-widget-area' => array ( ), 'second-footer-widget-area' => array ( ), 'third-footer-widget-area' => array ( ), 'fourth-footer-widget-area' => array ( ), 'array_version' => 3 ) );

    I don’t think there is a way to modify those 5 default ones, other than monkey-patching the source code 🙁

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Setting default widgets in twenty ten child theme?’ is closed to new replies.