Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

list-sidebar

// Register Sidebar
function custom_sidebar() {

	$args = array(
		'id'            => 'main-sidebar',
		'name'          => __( 'Main Widget Area', 'text_domain' ),
		'description'   => __( 'Appears on posts and pages in the sidebar.', 'text_domain' ),
		'before_title'  => '<h2 class="widgettitle">',
		'after_title'   => '</h2>',
		'before_widget' => '<li id="%1$s" class="widget %2$s">',
		'after_widget'  => '</li>',
	);
	register_sidebar( $args );

}

// Hook into the 'widgets_init' action
add_action( 'widgets_init', 'custom_sidebar' );