WordPress – Register a Sidebar / Widget Area
To truly create a custom experience for your site’s visitors you may want to have different sidebars / widget areas for various sections of your WordPress site. This function will allow you to create as many as you need. In the example code below we are registering two new sidebars for an “About” and “Contact” page.
function section_sidebar_widget_areas() {
// Register Sidebar Widget Area - About
register_sidebar( array(
'name' => 'Sidebar - About',
'id' => 'sidebar-about',
'before_widget' => '<section id="%1$s" class="widget clearfix %2$s">',
'after_widget' => '<span class="seperator extralight-border"></span></section>',
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>'
) );
// Register Sidebar Widget Area - Contact
register_sidebar( array(
'name' => 'Sidebar - Contact',
'id' => 'sidebar-contact',
'before_widget' => '<section id="%1$s" class="widget clearfix %2$s">',
'after_widget' => '<span class="seperator extralight-border"></span></section>',
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>'
) );
} // END Function
add_action( 'widgets_init', 'section_sidebar_widget_areas' );

Leave a Reply
Want to join the discussion?Feel free to contribute!