Additional Sidebars

When building a website using WordPress, you’ll often have a piece of content that doesn’t fit into a post or page; for example, an “Additional Information” box that appears above the sidebars on a specific page.  There are many approaches you could take:

  • Code it directly into the template files, which should only be done if the content won’t need to be changed (example: a footer on a website).
  • Include it as a custom field on a post or page. This is best for content that is page/post-specific, but found on almost every post or page (example: Photographer’s name associated with the post’s header image).
  • Build an additional sidebar. This is best for something that’s repeated often and/or needs to be easily editable.

I’m going to focus on the last approach using additional sidebars.

First you need to create an additional sidebar, then include it somewhere in your site, and finally populate it with content.

Creating an Additional Sidebar

In your functions.php file (or core functionality plugin), include the following code:

That will create a new sidebar titled “Additional Sidebar,” with the appropriate default parameters (which you can change if you like).

Include in Site

Now you can simply drop dynamic_sidebar( 'additional') directly in your theme somewhere.

Populate the sidebar with content

From your wp-admin area, go to Appearance > Widgets. You should see all of your sidebars displayed on the right side, and your choice of widgets on the left. If you just want text in this sidebar, drag the Text widget over to “Additional Sidebar” and fill it with your title and content. Once you save it, your sidebar should be ready to view on your site.

You can customize the look and feel of it using CSS.

For more information on building sidebars, check out Justin Tadlock’s excellent post Sidebars in WordPress.

Bill Erickson

Bill Erickson is the co-founder and lead developer at CultivateWP, a WordPress agency focusing on high performance sites for web publishers.

About Me
Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk

Reader Interactions

Comments are closed. Continue the conversation with me on Twitter: @billerickson

Comments

  1. Nigel says

    Hi Bill, Well the coding was the easy part for me, what I still don’t get is how to isolate widget content in different pages.

    At the moment my primary sidebar content shows on every page. I have two additional sidebars that are empty at the moment and I want to use them on two pages.

    So I want to turn ‘off’ Primary Sidebar widgets on two pages and turn ‘on’ the two new sidebars on these two pages.

    Confused? I sure am (anyone tried Concrete 5 so much easier)

    Could you please help with this, its got to be easy for someone who knows, and YES I AM using widget logic! Its just not working…

    Nige

    • Nigel says

      OK, I’ve just added some dummy content to my new sidebar (one of them) and that’s showing on every page too! This is despite widget logic [code]is_page(‘dog-boarding’)[/code].

      I thought that would isolate the widget to the dog-boarding page?

      I’m missing something, yes I admit this is my first WordPress site, is this to do with templates or something?

      Very confused!

      • Bill Erickson says

        I’d have to see the theme and your code to know what’s going wrong. If you’re using Genesis, I highly recommend you use the Genesis Simple Sidebars plugin. No code is required. You create new sidebars from the admin interface, and when editing a post or page you can select which sidebar to use.