ThemeShaper Forums » Thematic

Changing Default Widgets

(4 posts)
  • Started 12 years ago by Mischif
  • Latest reply from Chris
  • This topic is not resolved
  1. I am working on a child theme, but in order for it to look its best, I need to change the default widgets that appear in the primary and secondary asides. I know there was talk about putting this feature into thematic, but has it been applied yet? If so, how could I do it?

    Posted 12 years ago #
  2. Hi,

    this is integrated .. but you need to wait for WP 2.8.1 (hope so .. tested with 2.9-rare) .. the following code works under WP 2.7.x but not under WP 2.8:

    // Pre-set Widgets
    $preset_widgets = array (
    	'primary-aside'  => array( 'search'),
    	'secondary-aside'  => array( 'RSS Links', 'meta' )
    );
    if ( isset( $_GET['activated'] ) ) {
    	update_option( 'sidebars_widgets', $preset_widgets );
    }

    Chris

    Posted 12 years ago #
  3. I just tried this with a fresh install of 2.8.1, but it isn't working; I need search, links, archives and meta in that order in the primary aside and a text box in the secondary aside. I'm trying to make it work with this code:

    // Pre-set Widgets
    $preset_widgets = array (
    	'primary-aside'  => array( 'search', 'links', 'archives', 'meta'),
    	'secondary-aside'  => array( 'text' )
    );
    if ( isset( $_GET['activated'] ) ) {
    	update_option( 'sidebars_widgets', $preset_widgets );
    }

    I'm assuming I don't need to add an action in functions.php, just having it in there will work.

    Posted 12 years ago #
  4. This should work .. my code was thought as an example how to change the default widgets to something else.

    .. and .. yes .. you don't need a function. Just put the code into your child theme's functions.php

    Posted 12 years ago #

RSS feed for this topic

Reply

You must log in to post.