In functions.php file :
add_action( 'widgets_init', 'my_register_sidebars' );
function my_register_sidebars() {
/* Register the 'primary' sidebar. */
register_sidebar(
array(
'id' => 'sidebar-2',
'name' => __( 'Main Sidebar', 'mystic' ),
'description' => __( 'A short description of the sidebar.', 'mystic' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
)
);
/* Repeat register_sidebar() code for additional sidebars. */
}
In sidebar.php :
<?php
if ( is_active_sidebar( 'sidebar-2' ) ) { ?>
<ul class="submenu">
<?php dynamic_sidebar( 'sidebar-2' ); ?>
</ul>
<?php }
?>
EDIT
If you are looking to modify the output of Recent Posts Widget,
you can use this Extend Recent Posts Class 😉
All you have to do is to modify it as you want 🙂
SYA 🙂