Step 1: Open the “functions.php” of your theme and search for function {theme_name}_widgets_init().
If you are going to create your theme from scratch then, you have to define this function otherwise above function is already present and you have to modify it.
Step 2: In the above function write the below code for each widget area.
register_sidebar( array( ‘name’ => __( ‘{Sidebar Name}’, ‘(Theme Name}’ ), ‘id’ => ‘{Sidebar ID}’, ‘description’ => __( ‘{Some desription}’, ‘(Theme Name}’ ), ‘before_widget’ => ‘’, ‘after_widget’ => “”, ‘before_title’ => ‘
’, ‘after_title’ => ‘
’,
) );
Step 3: After completing the second step you are done with creating the sidebar or widget area creation.
Goto: “http://localhost/{project_folder_name}/wp-admin/widgets.php” on the right hand side you can see your newly created widgets.
Now you have to show this area in your site.
For that you have to write the below code where you want to show your created area.
Step 1: Open the “functions.php” of your theme and search for function {theme_name}_widgets_init().
If you are going to create your theme from scratch then, you have to define this function otherwise above function is already present and you have to modify it.
Step 2: In the above function write the below code for each widget area.
register_sidebar( array( ‘name’ => __( ‘{Sidebar Name}’, ‘(Theme Name}’ ), ‘id’ => ‘{Sidebar ID}’, ‘description’ => __( ‘{Some desription}’, ‘(Theme Name}’ ), ‘before_widget’ => ‘’, ‘after_widget’ => “”, ‘before_title’ => ‘
’, ‘after_title’ => ‘
’,
) );
Step 3: After completing the second step you are done with creating the sidebar or widget area creation.
Goto: “http://localhost/{project_folder_name}/wp-admin/widgets.php” on the right hand side you can see your newly created widgets.
Now you have to show this area in your site.
For that you have to write the below code where you want to show your created area.