How to Add a Custom Sidebar in WordPress

Sidebars are the widely useful and almost a compulsory element of any theme. If your theme do not have sidebar and you are thinking how to add a custom sidebar to WordPress theme then this article is exactly for you. This article show how to add a custom sidebar in WordPress. Sidebar is an important theme feature that is usually present in the left or right of the main content. They can be one or more vertical column that allows you to display the widgets in your theme. By default most of the themes have at least one sidebar. If you do not have any sidebars and want to have one, then you can use any one of the methods mentioned in this article.

If you know basic PHP and CSS you can easily implement the first manual method by adding a few lines of codes to the theme. The second plugin method is for the general users who do not have any kinds of coding skills.

How to Add a Custom Sidebar in WordPress

Method 1: Using the Code

Step #1 Edit the functions.php file

From your admin dashboard open the functions.php file by going to the Appearance > Editor. And then find and open the functions.php file from the right template column as show in the image.

How to Add a Custom Sidebar in WordPress

Add the following code in the functions.php file. The code will register your custom sidebar.

function awsome_widget_setup(){
        array (
            'name' => 'Custom-sidebar',
            'id' => 'sidebar1',
            'description' => 'Custom Sidebar to display widgets',
            'before_widget' => '<div class="widget-content">',
            'after_widget' => "</div>",
            'before_title' => '<h3 class="widget-title">',
            'after_title' => '</h3>',

Finally click the button named ‘Update File’ at the bottom to save the changes.


Step #3 Edit the template files to display the sidebar

Finally add the following code in the desired location of your template file where you want to display the sidebar. You can add the following code directly to any template file or you can also create a sidebar.php file and then paste the following code.

    if ( is_active_sidebar( 'sidebar1' ) ) :
    dynamic_sidebar( 'sidebar1' );

Here I have directly paste code to display sidebar in the single.php file.

Step #4:  Add the sidebar contents.

Now you can check if the sidebar has appeared in the dashboard by going to Appearance > Widgets. You can add the widgets you require by dragging and dropping the required widgets from left side in to the sidebar to the right.

Now the sidebar should appear in your website. If you are familiar with CSS then you can give your own styling and design to your sidebar.

Method 2: Using the plugin

The most reliable and the easiest way of adding a sidebar to your website is by using a plugin like Custom Sidebars. The plugin displays the custom widget configuration for every page or post on your site. You can create your own custom sidebars and widget area with just a few clicks. It is light and easy to use and gives you lots of options.

Also Read:   Create Contact Form Using Formidable Forms in WordPress

To install the plugin, go to Plugins > Add New and search for keyword Custom sidebars. Install and activate the plugin Custom Sidebars by WPMU DEV.

How to Add a Custom Sidebar in WordPress

After the activation of the plugin, go to Appearance > Widgets. Creating sidebar is super easy with one click sidebar creation. In the widget screen you can see a new button called Create a new sidebar which is added by the plugin.

When you click the Create new sidebar button, you get a pop up window where you can give the name and description of the sidebar you want to create. You can use sidebar location feature to locate the position of the new sidebar. You can make the new sidebar your default sidebar or any other footer sidebar.

To display the specific sidebar on any page or page, you can use the sidebar metabox. When you edit old post/page or create new post/page, you can see the sidebar metabox which allows you to select the sidebar and footer for the particular post and page. Thus you can easily create a new sidebar and display them in desired post and pages using this simple but effective plugin.


This article showed you how to add custom sidebar to WordPress for theme developers using code. For normal users, this article showed the use plugin to create and display sidebars. I hope the article was helpful. You can check our other articles on “How to Customize WordPress Site with CSS”.

The following two tabs change content below.

Kantiman Bajracharya

Kantiman Bajracharya is a freelance web developer. He is a computer geek who has a Bachelor’s degree in Computer Engineering. He has earned lots of satisfied customers while working for numerous successful projects. He is also a WordPress theme creator and web article writer. On free time he likes reading philosophy books, traveling and playing chess.

Share This Post