Skip to content

Sidebars

Aleksey Motovilov edited this page Jul 13, 2016 · 3 revisions

To register a new sidebar navigate to themename/app/config.php and find $sidebars variable. The array key means sidebar id, but the value is its title

$sidebars = array(
	'general-sidebar' => 'General Sidebar',
);

Here what is under the hood:

foreach ( $sidebars as $id => $title ) {
	
	register_sidebar(
		array(
			'id' => $id,
			'name' => __( $title, $domain ),
			'description' => __( $title, $domain ),
			'before_widget' => '<div id="%1$s" class="widget %2$s"><div class="widget-inner">',
			'after_widget' => '</div></div>',
			'before_title' => '<h3>',
			'after_title' => '</h3>',
		)
	);

}
Clone this wiki locally