WordPress Tip: Add More Widget Areas to Your WordPress Theme

You can add more than one sidebar section to your WordPress site. For example, with the stc-intermountain.org site, I added a whole bunch of additional sidebar sections in the Appearance > Widgets section.

Adding more sidebar sections

Adding more sidebars is useful if you’re using WordPress more as a content management system than a blog.

Someone asked me how I did this. The process isn’t hard. I’ve broken it down into three steps. (Before you continue with the instructions, you may want to back up the information in your existing sidebar.)

Step 1

Add this code to your functions.php file under Appearance > Editor.

if ( function_exists('register_sidebars') )
        register_sidebar(array('name'=>'Sidebar Home','before_title'=>'
','after_title'=>'
'));
        register_sidebar(array('name'=>'Sidebar Jobs','before_title'=>'
','after_title'=>'
'));
        register_sidebar(array('name'=>'Sidebar Meetings','before_title'=>'
','after_title'=>'
'));

Note: Sometimes you have other sidebar code that looks similar to the above. If so, use it instead.

In this example, the sidebars that will be added will be called Sidebar Home, Sidebar Jobs, and Sidebar Meetings. Change the names to whatever you want. You can add many more sections here, not just three.

You can also add more arguments than simply name, before_title, and after-title. See the full function reference and arguments with registering sidebars.

You’ll also need to delete the previous register_sidebars function so that the two don’t conflict.

Step 2

Add a reference to the sidebar section where you want the sidebar to appear in your theme. For example, type the following to insert the Jobs sidebar:

To insert the Meetings sidebar, you would type Sidebar Meetings rather than Sidebar Jobs.

Step 3

In a text editor, duplicate your existing sidebar code, rename the file (for example, sidebar_jobs.php), and FTP the file into the folder with your other theme files.

Where you want the file to appear (probably in a specific page template), add this reference to the file:

Remove the other code that calls the sidebar (probably get_sidebar). Now that page template will show your Jobs sidebar. And you can configure your Jobs sidebar under Appearance > Widgets.

Although I’ve mainly been calling these sections a sidebar, you can create sections and insert them anywhere in your site, such as the footer, an ad space in the header, or elsewhere.

follow us in feedly

Madcap FlareAdobe Robohelp

This entry was posted in general, WordPress on by .

By Tom Johnson

I'm a technical writer working for a gamification company called Badgeville in the Silicon Valley area in California. I'm primarily interested in topics related to technical writing, such as visual communication (video tutorials, illustrations), findability (organization, information architecture), content development (DITA, testing), API documentation (code examples, programming), web publishing (web platforms, Web design) -- pretty much everything related to technical writing. If you're trying to keep up to date about the field of technical communication, subscribe to my blog either by RSS or by email. To learn more about me, see my About page. You can also contact me if you have questions.

7 thoughts on “WordPress Tip: Add More Widget Areas to Your WordPress Theme

  1. Larry

    Hey Tom! I would like to add a left sidebar to the 2-column right-sidebar layout. I’ve created a new section, but where exactly should I insert it to appear to the left?

    Thanks!

    1. Tom Johnson

      Larry, in reading your comment, I think I mistitled my post, so I just changed the title: “Add More Widget Sections to Your WordPress Appearance > Widgets Page.” In my post I explain how to add more widget sections, not sidebars. But since sidebars are 90% of the widget sections out there, I called in that in my original post.

      If you’re trying to add a new sidebar to your theme, copy your sidebar.php code into a new file and call it something like sidebar_left.php. Upload it to your theme directory. Now try to follow the steps I outlined in this post to call the sidebar and add content to it via a new widget section.

      Sorry I can’t be more help, but if you want to hire me to create this for you, let me know.

  2. Chris

    Hi Tom

    Very nice article indeed!

    I want to add a widget section to the left of post/page content section. Do you have any idea in what file and where I need to add that little piece of code (step 2). I don’t want to use a left sidebar, but just hook the widget section directly onto the section that displays post and pages effectively making the content section display as 2 columns

    Thanx!

  3. Jan

    Hi There,
    This was exactly what I”m looking for, but I keep breaking my theme when I do these three steps.

    I think what I’m confused about is in your example what does the sidebar_about.php code look like?

    Does the code in step two go in the new sidebar_about.php page? or does the code in step two go on the template page?

    I’m not sure what I’m missing, I’ve tried it both ways and breaks my theme. I’m using an eleganttheme.

  4. zuby

    Am using wordpress app theme classipress but i cant place the search box on top instead of right . and its categories are open on click i want it to change on mouse over so please help .

Comments are closed.