If you’re looking for a way to make your posts or pages in WordPress not all look the same then WordPress custom sidebars are the way to do it. 👍
With WordPress custom sidebars, you can create unique sidebars for different pages within your site. In other words, you don’t have to agree to whatever sidebar structure your theme came with and can instead create something entirely original.
Why use WordPress custom sidebars?
Let’s list a couple of possible use scenarios.
At the top of the list, custom sidebars are great when you want to show different widgets on your individual post pages vs the main listing of posts.
For example, you could have a list of your popular posts on the main listing page, but then have social media share buttons or a table of contents module on the individual posts.
Then, WordPress custom sidebars can also play an important role in a WooCommerce store setup.
For example, you can display recommended products on your individual product pages. But then, you can show a section promoting linked products once the customer is on the cart page (“customers who bought this also bought”). Lastly, on the checkout page, you can use the sidebar to show payment gateway badges and other elements that make your site look trustworthy.
How to create custom sidebars in WordPress?
There are two main paths you can take:
- do it with plugins,
- do it without plugins.
Getting a custom sidebar WordPress without a plugin is the preferable path for most users. But let’s start with the plugin route anyway, just to give you the full perspective on the topic:
Creating a custom sidebar with plugins
The good news is that you can add custom sidebars to any WordPress site, no matter your theme or site type (blog, ecommerce, etc.).
The bad news is that the plugins that let you achieve this are not yet all fully compatible with the new block widgets in WordPress.
For now, if you want to have custom sidebars working reliably, you’re better off disabling the block widgets altogether and only then adding custom sidebars to your site.
Therefore, first order of business is to install the Classic Widgets plugin, which will disable the new block widgets and bring back the old-school widgets. With that done, you can use one of two popular plugins for custom sidebars:
Both are fairly easy to use, but they do have their unique ways to go about delivering on the promise.
With Custom Sidebars, you get the job done all in your dashboard’s Appearance → Widgets section.
This is where you can add a new widget area (by clicking on “+ Create new sidebar“) and then set its display logic by clicking on Sidebar Location.
You can pick from a number of predefined conditions, which should cover all the common scenarios of you needing WordPress custom sidebars.
Sidebar Manager works a bit differently, but it’s similarly easy to use.
To start, go to Appearance → Sidebars. Create a new sidebar area by clicking on the Add New button.
Each new sidebar you create is meant to replace an existing sidebar on the site. You pick the sidebar to be replaced in the first field.
Next, you can tune up your display logic. The plugin allows you to create display rules as well as exclusion rules. Lastly, you can decide whether the sidebar should be displayed based on user role.
What these settings do is only create a new sidebar area. We haven’t added any widgets to it yet. To do that, go to Appearance → Widgets.
You’ll see your new sidebar area there, alongside all your old sidebars. Just add whatever widget you wish to that new sidebar areas.
Creating a custom sidebar WordPress without plugin
There are two ways you can go about this:
- write a custom code solution,
- utilize your theme’s built-in functionality.
This won’t be a surprise, but writing custom code to get custom sidebars into WordPress is not particularly fun. Granted, the syntax might not be too complex when you copy and paste it, but the potential to crash your site is big.
Still, if you’re interested how to do this manually, look up the Widgetizing Themes section of the WordPress Codex.
A much more reliable path to take is to use your theme’s built-in functionality for custom sidebars. That is, of course, if your theme offers any such functionality.
For the purpose of this tutorial, we’re going to use Blocksy – our flagship theme.
ℹ️ Blocksy Pro is required for custom sidebars.
To get started, go to the main section of Blocksy in the WordPress dashboard and switch to the Extensions tab. Scroll down to the bottom of the list and Activate the Multiple Sidebars module.
With this done, you can go to Appearance → Widgets.
Apart from the usual list of all your widget areas there, you’ll also see a new section up top; this is where you can create new sidebars:
That new widget area/sidebar will behave like any other widget area you have on your site. You can add whatever widgets you want to it – and now also the new block widgets, which Blocksy supports fully.
The last thing left to do is set the display conditions – aka decide where your new custom sidebar should appear. 🤔
To do that, click on the gear ⚙️ icon in the top right corner of your new sidebar. You’ll see a box where you’ll be able to add the conditions.
- Click on Add Display Condition for page-based conditions (things like displaying on all post listings, etc.)
- Click on Add User Condition for controlling sidebar display based on the status of the person viewing the page (whether they’re logged in, etc.)
As you can see, I’ve chosen to display this sidebar on all my Single Post pages.
ℹ️ This new sidebar will get displayed in place of the sidebar that was originally on the page matching the display conditions. If you want to keep the content from that original sidebar, you’ll need to add it to the new custom sidebar as well.
As soon as you save the settings, you’ll see your new sidebar in action.
Overall, adding a custom sidebar to WordPress without a plugin is a much more elegant solution vs going any other route. You don’t have to worry about compatibility with the new block widgets, not to mention the need to maintain handwritten code.
Have you experimented with some form of WordPress custom sidebars? Let us know how this has worked out for you in the comments below.
⭐ If you want to test how WordPress custom sidebars work in Blocksy, you can get Blocksy Pro with a 14-day money-back guarantee.