WordPress widgets are used to add extra features or functionality to your theme. They are added to your theme sidebars or widget areas, including footer and after post areas. Some of the widgets are included with the theme, such as Recent Posts or Search widgets, and others you or your website developer will add using plugins. They can include videos, email newsletter signups, social media follow, recent posts, display your Instagram images, a brief about you, shopping carts, and calls-to-action, almost any functionality.
So you’ve added some cool widgets to your sidebar or footer. What happens when you don’t want to show one of them on a particular page? What if you want to hide sidebar widgets on some WordPress pages and posts? Or what if you want to show a different widget, depending on the post category?
Let’s use the examples to show a different widget depending on the post category. We’ll look at three different plugins.
One of my favorite widget visibility plugins is Widget Options – Add Context To WordPress Widgets; it is understandable and versatile too. There is a settings page that allows for controlling other options too, such as hiding the title. This plugin displays selections for showing the widget on posts with categories – Genesis Tutorials and Miscellaneous. See more on this plugin in the comment below from one of the plugin authors, Jeffrey Carandang.
Jetpack Widget Visibility
If you use Jetpack, there is a Widget Visibility module that is included with the Jetpack plugin. The selections make it super easy for anyone to make the right choices to show or hide sidebar widgets for a particular category, by clicking the Visibility button near the blue Save button at the bottom of the widget. For instance this image has the selections to show the widget on posts in Category #1 and Category #2. You can use the Add links to add more categories or pages.
If you’re a developer or understand WordPress conditional statements, you can use the plugin Widget Logic to write the conditional statement to show or hide the sidebar widgets. It is located just below the widget, as the others are. But since this plugin takes PHP code, it’s not a plugin for most users. This example uses the category IDs 24 and 25 to show the widget for posts and archives in Category #1 and Category #2.
There are other plugins to show or hide sidebar widgets, but these are the easiest or most versatile for me. A final mention is Content Aware Sidebars. This is more than a widget visibility plugin though, and allows for different sidebars on different page or post types.
4 responses to “Hide Sidebar Widgets on WordPress Pages and Posts”
Dynamic Widgets is a great plugin for controlling widgets. I’ve used it for years and it is very, very well supported. However, I have yet to ask for support – it really works well and is very customizable.
It’s good to know that you really like Dynamic Widgets because it can handle some complex options.
I’ve included the link for anyone who needs a more robust solution.
I didn’t include it in the post because it’s much more complex to set up.
Thanks for the addition!
Widget Options will be a perfect addition to the list too and it’s also available for free on the repository : https://wordpress.org/plugins/widget-options/ . You can show or hide any widgets on any WordPress pages, categories and taxonomies, post types and more! You can also set visibility per devices such as mobile. It also has Display Widget Logic option if you prefer custom conditional code.
Widget Options will also make your widget management better! You can add custom widget classes, hide title and you can have live search filter on the admin widget dashboard.
I hope you’ll love this plugin and will be of great help on your website! Forgot to mention at you can enable/disable any features you want. Thanks!