Have you ever wondered how to show WordPress widgets on select pages only and not others? Unfortunately WordPress does not have this capability, which makes you wonder why? You would think that this would be considered important when building a website, but obviously they don't feel the same.
The Problem With WordPress Widgets
Ever since I started using WordPress, there was something that boggled my mind. For some crazy reason, WordPress refuses to add the ability to show or hide widgets on specific pages. I remember asking them why this was not a function built-into WordPress. Their answer was to simply use a plugin! Not the answer I was looking for and to this day, they still have not given an honest reason.
WordPress widgets are used every day by millions of WordPress users, so it only makes sense that I show you how this is done. Drag a widget into a sidebar position, you will notice there is no option or setting let's you choose what page or post to show (or hide) it on. Just as it was said to me, your only option is to use a plugin; so that is what we will use.
There are several plugins we can use to show or hide our widgets, with each one having pro's and con's, so I will take you through the plugins I've used.
Widget Logic is not that bad and does offer the basics of what you need to show or hide WordPress widgets, but you need WP Conditionals to make it work. If you want to use this plugin, I recommend you bookmark the WP Conditionals page for reference. Basically how this works is that you type in a conditional like you see in the above screenshot. If you wanted this widget to show on all pages, you would use is_page() as the conditional. However, if you wanted it to show on just the Contact page, you would type in is_page('contact') or use the page ID as is_page('23') as the conditional.
JP Widget Visibility and Widget Visibility Without Jetpack
I've decided to combine these two plugins because they are similar to each other and both are based on the Widget Visibility module in Jetpack. I actually use the JP Widget Visibility plugin for my WordPress theme demo sites which seems to work just fine even though on the WordPress plugin's directory, we get this notice: Regardless of the notice, it still works just fine, but for how long down the road, it's hard to say. However, to use it, you don't need WP Conditionals, you simply click on the "Visibility" button at the bottom of the widget. This shows a hidden panel with three drop-down settings to choose how and where to show or hide the widget. For the Widget Visibility Without Jetpack plugin, it's very similar in functionality with the exception it adds the option to include the "children" of the where you are showing or hiding the widget:
Widget Visibility - Jetpack
Seriously overkill if you just need to use their Widget Visibility module, but if you are using Jetpack already, you don't need any other plugin. The Widget Visibility module does exactly what the other two do, but the difference is that you are using the module direct from the creators.
Using Widget Visibility
It's really screwy what Automattic did with Jetpack, but to enable the Widget Visibility module, you have to find it! Go to the Jetpack settings and then at the bottom of the page is a Debug link that you need to click on. From there, you will get a screen with lots of messages, blah, blah, blah. Look for the "Access the full list of Jetpack modules...." hidden on the page and click it. Now you can find Widget Visibility on the list and as you hover over it, click on the "Activate" link and then you are done! This will add Widget Visibility to the bottom of every widget.
Other Options for WordPress Widgets
Unfortunately there is no easy method to manage where your widgets are shown, nor is there really any development to make widgets easier to use period! Aside from the above options, there are a few others, but I was not a fan.The idea is to find a plugin that requires the least amount of work, but so far, the above seems to fall into that category—the exception being Widget Logic.
Please let me know in the comments or through my Twitter and Facebook pages if there are additional (quality) choices.