Custom Sidebars for WordPress Pages

Share Button

Do you have a WordPress theme that you really like, but it would be great if you could change the sidebars for certain pages? Most developers will tell you that first you go into functions.php and register the new sidebar, then create a custom page template. But, what if you don’t want to touch any PHP or even HTML for that matter? What if you just want a simple way to add custom sidebars when you want? If so, this tutorial is for you.

Custom Sidebars with Page Appropriate Menus

I recently had a client who wanted to put a short menu in the sidebar for their pages. But, they also wanted to be able to use different menus on different pages.

The solution to create this functionality is the Per Page Sidebars plugin. If you go over and visit that link you’ll see that it hasn’t been updated in a while, but it still works just fine. There’s an old saying if it aint broke, don’t fix it. The developer still tracks the plugin and is still around for support.

To follow along with this tutorial, make sure that you have installed and activated the Per Page Sidebars plugin.

Create the Custom Sidebar

The first step is to go to the page that you want to put the custom sidebar on. If you want to apply it to a whole group of pages, you should go to the parent page of the group. In this example I’m going to apply the sidebar to the About page which has 5 subpages. All of the subpages will automatically inherit the sidebar.

On the edit screen of the page that you want to add the sidebar to, scroll all the way down. You’ll see a section called Custom Sidebar. Check the “Activate Custom Sidebar?” box and then select the sidebar to replace (in most cases it will the item called “Sidebar”).

activate-custom-sidebar

Now scroll back up and click on Update in the Publish section (or Save Draft if you haven’t published the page yet).

Configure the Custom Sidebar

Now that the sidebar is created it will show up as a widget area. Go to Appearance in the left menu and then select Widgets. There will be a new widget area that starts with PPS-. Since I’m editing the about page, it’s called PPS-about.

sidebar-widget

Now go ahead and add to this widget area just like you would any other sidebar. In this case I’ve just added a Custom Menu widget to it. Save your widgets as you add them and then go ahead and view your page.

If you’ve modified a parent page, all of it’s subpages will inherit the new sidebar. If you’ve modified a page with no subpages, then only the page itself will get the new sidebar.

When Won’t The Plugin Work?

There are a few cases in which using the per page sidebar plugin isn’t going to work for your situation. Generally this includes if you want to have data in your sidebar which isn’t available as a widget. The plugin builds all of its sidebars as widget areas which are filled with widgets.

If you want to add things that aren’t available as widgets to your sidebar, you will need to go the route of custom templates. If you aren’t familiar with PHP and reading APIs, you should go talk to a developer. If you start editing the functions.php file in your WordPress theme, one misplaced semi-colon can render your entire site non-functional.

If your site is not structured with parent pages and subpages the plugin will not be the best solution. If you want to change 10 pages to use the same sidebar, but they aren’t grouped together, you will end up creating 10 custom sidebars and having to copy the information to each of them. In this case, you are better off making a template to suit your needs.

Conclusion

Using different sidebars for different groupings of pages is a common desire with a WordPress website. The Per Page Sidebars plugin allows you to easily create sidebars when you need them and apply them to groups of pages.

Share Button

Leave a Reply

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