How to Create a Second Sidebar With WordPress

If you only have one sidebar on your business site, you can add a second to display more content to your customers. For example, you could use one sidebar to showcase your blog content, and the other to show details of special promotions, new products and new services. Do this by uploading a new file to your theme folder and letting WordPress know about it through “functions.php.” Your sidebar will then appear in the Widgets part of your control panel.

Step 1:

Open a text editor and paste in the following code:

$sidebar_class = woodmart_get_sidebar_class();
$sidebar_name = woodmart_get_sidebar_name();
if( $sidebar_class == 'col-sm-0' ) return;
<aside class="sidebar-container <?php echo esc_attr( $sidebar_class ); ?> area-<?php echo esc_attr( $sidebar_name ); ?>" role="complementary">

You can rename “sidebar2” to “sidebarleft” or anything else more appropriate, if you wish. Save the file as “sidebar2.php”.

Step 2:

Log in to your FTP account, navigate to “” and upload “sidebar2.php” to this folder.

Step 3:

Log in to your WordPress admin area, go to “Appearance” and click “Themes.” Click one of the template files from the list on the right that you want the second sidebar to appear in, then paste the following line into the code at the point you want it to be called:

Save the file, and repeat this process for all other template files to which you’ll be adding the second sidebar.

Step 4:

Click “functions.php.” Copy all the code into this file and paste it into a blank text document. Save this to your computer. If you make a mistake, you can restore this, but sometimes errors in this file prevent you accessing the administration area, so you may have to upload your backup via FTP to the same theme folder you uploaded “sidebar2.php” to.

Step 5:

Locate the lines of code that register the sidebars in “functions.php” — they are usually near the top. Edit the code to make “register_sidebar” plural, and add a number “2” between the brackets in the line below, like this:

if ( function_exists('register_sidebars') ) register_sidebars(2);

Click “Update File.” The sidebar is now available by going to “Appearance” and then “Widgets.”

Now your sidebar is ready. Learn Free Online Web Development.

Leave a Reply

Your email address will not be published. Required fields are marked *