post

How to Make My Own Genesis Child Theme Sidebar Available and Not the Default Primary and Secondary Sidebars

So if you want to make the two original sidebars unavailable, you first need to unregister those sidebars. To do this, add the following to your functions.php file.

//Unregister Sidebars
unregister_sidebar('sidebar');
unregister_sidebar('sidebar-alt');

// Remove Default Genesis Sidebar
remove_action('genesis_sidebar', 'genesis_do_sidebar'); 

Then you need to register your new widget area:

add_action('genesis_sidebar', 'child_do_sidebar');
function child_do_sidebar() { ?>
<?php    if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Child Sidebar') ){    ?><?php    }    ?>
<?php }

Then add your Child Sidebar:

// Add Child Sidebar
genesis_register_sidebar(array(
 'name'=>'Child Sidebar',
 'id' => 'sidebar-primary',
 'description' => 'This is the primary Child sidebar',
 'before_widget' => '<div id="%1$s"><div>',
 'after_widget'  => "</div></div>n",
 'before_title'  => '<h4><span>',
 'after_title'   => "</span></h4>n"
));
post

How to Unregister or Remove the Secondary Sidebar

Ever get the question, “I placed my widget in the sidebar but it doesn’t appear! Why!?” only to discover that they moved the item to the Secondary Sidebar. How about just removing that sidebar altogether? Here’s how:

unregister_sidebar('sidebar-alt');
post

How to Switch Primary Sidebar to Secondary Sidebar for a Specific Page in Genesis

For one of my sites, the person wanted to use two different sidebars: one for his store and another for his blog. The rest of the site was full-width layout. So we used the two sidebars: Primary (sidebar) and Secondary (sidebar-alt). So here’s how to switch sidebars (without using Nathan’s phenomenal plugin Simple Sidebars) using functions.php.

//switch sidebars
add_action('get_header','change_genesis_sidebar');
function change_genesis_sidebar() {
    $pages = array(181);

    if ( is_page($pages)) {
        remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
        add_action( 'genesis_sidebar', 'genesis_do_sidebar_alt' );
    }
}  

This code can be easily adapted to be done based on category, archives, author, etc. See the conditional tags for more details.