Create Custom Sidebar in WordPress


In this post i am going to show you how to create custom sidebar in wordpress.
First of all go to theme editor (Appearance > theme editor). select your activated theme and open functions.php file.
Step 1: Add this code to your functions file.

add_action( 'widgets_init', 'my_register_sidebars' );
function my_register_sidebars() {
            'id'            => 'primary',
            'name'          => __( 'Primary Sidebar' ),
            'description'   => __( 'A short description of the sidebar.' ),

Step 2: Add this to where you want to show your sidebar
Note: this will be in php tag

 dynamic_sidebar( 'primary' ); 

Create Custom Sidebar in WordPress