How can I add another widget area to the twenty ten wordpress child theme?

Mar 13, 2012   //   by   //   Blog, Wordpress Theme Tutorial  //  No Comments

I’m trying to create a four column twenty ten child theme.
I have a rough idea how to make three but I don’t want to go messing with the original twenty theme to make four

First, you must register another Widget area with a code like this in functions.php:

register_sidebar( array(
    'name' => __( 'Your Widget Area', 'your_child_theme' ),
    'id' => 'my-widget-area',
    'description' => __( 'The primary widget area', 'your_child_theme' ),
    'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
    'after_widget' => '</li>',
    'before_title' => '<h3 class="widget-title">',
    'after_title' => '</h3>',
) );

then in the code of your child theme, you can use it

if ( is_active_sidebar( 'my-widget-areaa' )) {
  dynamic_sidebar( 'my-widget-area' );

Leave a comment

Share This Post

RSS Wordpress News