You can register a new sidebar as a snippet like this:
add_action( 'widgets_init', function () {
register_sidebar( array(
'id' => 'unique-sidebar-id', // make sure this is lowercase and unique
'description' => 'Sidebar description.',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>'
) );
} );
Of course, you will still need to output it somewhere in your theme. If you want to display it in a post/page content, you can add it as a shortcode:
add_shortcode( 'my_sidebar', function () {
ob_start();
dynamic_sidebar( 'unique-sidebar-id' );
return ob_get_clean();
} );