Part 8: How to Create Sidebar (widget areas) in WordPress?

I know you will be wondering how to create sidebar(widget areas) all about. Maybe you will feel like it is difficult to do. Never mind, this article will help you to know about how to create sidebar(widget areas) in WordPress. 

Read our article spending your time, and am sure once you are done, you will be able to create the sidebar of your own effort. Let’s get started! 

Widgets are modules enabling the user to add content and features to certain theme areas called widget ready areas or sidebars. Widgets areas let you add links, custom text, social links, navigation menus, calendar, and many features.  

Initially, if we are creating the theme from scratch, we won’t be able to see the Widgets option in the WordPress admin panel. To use the widgets, we have to enable to widgets option first. In order to enable the widget area, add the following lines of code in your functions.php file. 

function my_custom_sidebar() {
       array (
           'name' => __( 'Custom', 'your-theme-domain' ),
           'id' => 'custom-side-bar',
           'description' => __( 'Custom Sidebar', 'your-theme-domain' ),
           'before_widget' => '<div class="widget-content">',
           'after_widget' => "</div>",
           'before_title' => '<h3 class="widget-title">',
           'after_title' => '</h3>',
add_action( 'widgets_init', 'my_custom_sidebar' );

Then insert the following lines of code on location which you want the widgets to appear:

<?php if ( is_active_sidebar( 'custom-side-bar' ) ) : ?>
   <?php dynamic_sidebar( 'custom-side-bar' ); ?>
<?php endif; ?>

Then navigate to Appearance > Widgets to see, if the new sidebar is visible. Then you can just drag and drop the widgets that you are required for the newly created sidebar. 

newly created sidebar in wordpress

For example, we have added the Search and Recent posts widget in the footer. Now the added widgets will be displayed on your website at the required area. 

newly created sidebar in wordpress


You can even achieve this installing plugin. You can pick a plugin which is good in functionality and active it for creating a custom sidebar. Hope you understood how to create sidebar(widget areas) in WordPress.

You may also like this articles

If you have any queries or comments, please feel free to comment to us. You can subscribe to us on Facebook and Twitter.

Leave a Comment