In additon to wordpresser answer, you can also call to get_sidebar(‘sidebar-aside-content’); only in the template files where you want the sidebar be displayed. For example, if you include
<?php get_sidebar('sidebar-aside-content'); ?>
in “theme_folder/single.php” file, the sidebar will be displayed only in single posts.
For example. In functions.php:
//Register your sidebar
add_action( 'widgets_init', 'my_widgets_init' );
function my_widgets_init() {
register_sidebar( array(
'name' => __( 'The title of my sidebar', 'curioso' ),
'id' => 'sidebar-mysidebar',
'description' => 'An optional widget area for my sidebar',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => "</div>",
'before_title' => '<h3>',
'after_title' => '</h3>',
) );
}
Now you have to create a file named sidebar-mysidebar.php and put it in you theme folder. This file will load the widgets. For example:
<?php if ( is_active_sidebar( 'sidebar-mysidebar' ) ) : ?>
<div class="mysidebar">
<?php dynamic_sidebar( 'sidebar-mysidebar' ); ?>
</div>
<?php endif; ?>
Now in the file of your theme where you want ‘mysidebar’ be displayed:
<?php get_sidebar('mysidebar'); ?>