WordPress require 2 steps to use sidebar.
Step 1.Register sidebar
Register your sidebar in theme. add below code in your theme function.php. add widget to your sidebar
add_action( 'widgets_init', 'theme_slug_widgets_init' ); function theme_slug_widgets_init() { register_sidebar( array( 'name' => __( 'My Sidebar', 'theme-slug' ), 'id' => 'sidebar-id-here', 'description' => __( 'Widgets in this area will be shown on all posts and pages.', 'theme-slug' ), 'before_widget' => '<li id="%1$s" class="widget %2$s">', 'after_widget' => '</li>', 'before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>', ) ); }
Your sidebar will be appear in Appearence>Widget menu. add
Step 2.Use sidebar in theme
Edit your theme template where you wish to call sidebar
<?php if ( is_active_sidebar( 'sidebar-id-here' ) ) : ?> <?php dynamic_sidebar( 'sidebar-id-here' ); ?> <?php endif; ?>