How to Display or Hide Widgets on Specific Pages and Posts

In this post I will cover 2 plugins which can be used to conditionally display widgets on specific pages. There are a lot of use cases for conditionally displaying widgets. For example if you want to display the login widget on particular pages, then you can do so easily with these plugins

Using the Display Widget Plugin (link)

The Display Widget Plugin is immensely popular. It has been downloaded half a million times and has rating of 4.8.

Using the plugin is quite straight forward. Just Install and activate the plugin.

Activating the plugin will add more options to your widgets. Refer to the following screenshot

Display Widget Plugin Screen

As you can see , the plugin allows you to quickly display / hide widgets on selected pages. One can also choose to display widgets to only logged-in or logged out users. This is a very intutitive plugin, The only thing which bothers me is that this plugin was updated almost an year ago.

Using the Widget Logic Plugin (link)

This is another very popular plugin. It has been downloaded more than 900,00 times and has a rating of 4.9 .

Installing this plugin will append a logic box to every widget. Refer to the screenshot.

Widget Logic Screen

One can input now input condition (s) in the logic box. So for example if you want to display the widget on page with ID 42, then simply use the logic is_page (42). This will ensure that the widget appears only on the respective page.

One can also enter multiple conditions. For example  is_page (42) || is_page (81)   will display widget on page with id 42 and 81. This is a very powerful plugin, you can also use this plugin to display the widget on category pages, on custom post type etc.

If you have any questions then ask in the comments.

Check out this post for a more comprehensive collection of plugin for controlling widget visibility.

Leave a Comment