How to Show or Hide any WordPress Widget on Certain Pages

Have you ever thought of creating a widget which will be visible only on homepage? Or only on posts or Category pages? If yes then read on the post.

Before getting on to controlling widgets visibility methods, let’s see why you should do this or what can you do with this functionality –

  • You can show widgets only on Homepage.
  • You can show widgets only on posts (or certain posts).
  • You can show widgets only on category pages (or certain category pages).
  • You can show widgets only to logged in or logged out users.
  • etc etc

Now let’s check out how to show/hide widgets on specific WordPress posts or pages.

How to Show or Hide any Widget on Certain Pages

Showing or hiding widgets on certain pages is quite easy. You can get this done by using two plugins. Let’s check out these plugins.

1. First one is called Display Widgets. Controlling Widget visibility is easier with this plugin. You can download it from here. When you install the plugin, it’ll add options to show/hide with every widgets.  Check out the image below.

Show Hide Widgets
Show/Hide Widgets

You can select here the option to Show or Hide widgets on specific pages. There are many options available. For example – you can show any widget only for logged in users, or hide from logged in users.

Other options includes Pages, Categories, Custom Post types. You can also show widgets on specific post by putting  list of post IDs in the widget options.

2. Second plugin is named Widget Logic. Newbies might find it a bit hard to use. But actually it comes with more possibilities than the first one. Download it from here.

After installing the plugin, you’ll see a new field “Widget Logic” with every widgets. Check out the image.

Widget Logic
Widget Logic

What you need to put in this field is WordPress Conditional Tags. If you have no idea what those are you can check in WordPress Codex. Conditional tags give you more power to control visibility of  things in WordPress.

For example, you want to show a widget only on the Homepage of your blog. Then put is_home() in the Widget Logic field. For only posts, you can use is_single(). Full list of Conditional Tags.

Widget Logic plugin also comes with some advanced options. You can find them at the bottom of your widgets setting page. These options are – Add ‘widget_content’ filter, Use ‘wp_reset_query’ fix. You can also select when to load the logic.

Widget Logic Advanced Options
Widget Logic Advanced Options

Using the Export Options button you can export these settings. You can also import settings if you have a settings file.

For detailed information about this option click here.

Let us know if you use other plugins or system to show/hide widgets on certain pages. Also, If you face any difficulties using these plugins, feel free to ask us through comments. 

2 responses to “How to Show or Hide any WordPress Widget on Certain Pages”

  1. Jeffrey Avatar
    Jeffrey

    Hi Istiak,

    Display Widgets has been missing on the repository.

    I highly recommend Widget Options for replacement – https://wordpress.org/plugins/widget-options/ which is also available for free on the repository. I wish you can update the article using this one instead. Thank you very much!

  2. Ahsan Avatar

    I already used Display Widgets to hide different widgets from a certain page. But sometime it doesn’t work appropriately. I’ll try another plugin – Widget Logic. seems it is better than previous one.

    Happy blogging

Leave a Reply

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