First, register a new sidebar. The before_widget
, after_widget
, before_title
and after_title
arguments are optional and allow you to customize the HTML output.
genesis_register_sidebar( array( 'name'=>'Custom Sidebar', 'id' => 'sidebar-custom', 'description' => 'This is a custom sidebar', 'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget-wrap">', 'after_widget' => "</div></div>", 'before_title' => '<h4 class="widgettitle">', 'after_title' => "</h4>" ) );
Then inject the sidebar into the appropriate hook with genesis_widget_area()
. The function conditionally displays a widget area.
add_action( 'genesis_sidebar', 'child_do_sidebar' ); function child_do_sidebar() { genesis_widget_area( 'sidebar-custom', array( 'before' => '<div id="sidebar-custom">', ) ); }
See the available arguments for genesis_widget_area()
in /genesis/lib/functions/widgetize.php
Update 28 Dec 2012: Replaced dynamic_sidebar()
with genesis_widget_area()