Having the most suitable widgets will make your WordPress website extremely user friendly and will improve its functionality. That is why most themes have many sidebars and header and footer widget areas. And this is actually the charm of WordPress since you can easily create the most appropriate website for your target audience. Adding widgets is simple – drag and drop from the list of all available ones to the respective widget area and then brief settings, a click on the “Save” button and that’s it! Simple, fast and most importantly – extremely efficient.

This is great but what if some widgets have to be visible on a number of selected pages only? How can you manage this? Let’s find out!

In this post I will show you three ways of achieving this. You may use either of them or you may also combine them for further efficiency in some cases. The most important thing is to have a clear plan which widget should be displayed and where. I’ll get back on this topic later in the post.

The first and most easy way is by using Jetpack.

Yup, this powerful plugin comes to the rescue once again and it provides all the necessary features needed to manage widget visibility out-of-the-box.

How to use it? Just add a widget of your choice to the desired area on your theme. Now if Jetpack is installed and activated you should be able to see this button next to the “Save” button of the widget:

Jetpack Visibility Module for WordPress widgets

Click on it and more options will appear allowing you to set under what circumstances should the following widget be visible. You have two primary possibilities – to show the widget or to hide it.

Show widgets on specific pages with Jetpack - WordPress

*The images are embedded from Jetpack’s official website

Now let’s assume that you want to show a widget. Now you have to set the criteria for this choice. You may for example select a specific page or specific category and you may continue to do so until you are satisfied. When you are done you should save the widget and it will be shown only if the criteria is met. Easy, right?

However there is something to be aware of. If multiple tags or categories are applied for a post and you want the widget to be visible under a specific category/tag you should consider whether you should remove these tags/categories if the widget is not to be shown on this specific post. There is no way to set both “Show” and “Hide” logic using Jetpack.

But you can achieve this with the other solution that is suitable for the task at hand – the WordPress plugin Widget Logic.

Widget Logic allows you to display specific WordPress widgets on specific pages

Install and activate the plugin and you will receive an additional field under each widget in which you have to enter the criteria to show/hide it. This is a very powerful plugin but unfortunately it is hard to use by beginners. It requires PHP code that has to be entered in the field. For example if you want to show a widget for a specific category and then for a specific post inside this category you have to type in the following code:

is_category(X) || (is_single() && in_category(X))

*Code copied from the Widget Logic’s FAQ page.

One unique feature of Widget Logic is its ability to show/hide widgets when using WPML. This is very important as some of the widgets will not be suitable for all languages. Therefore if you (for example) have a multilingual website with WPML enabled and you want to display a specific widget on all German pages you have to place the following code:

ICL_LANGUAGE_CODE == ‘de’

Too user unfriendly for you? Don’t worry! You can use another plugin that is quite suitable for beginners and has additional features. It is called Widget Context.

Widget Context to display widgets on specific pages in WordPress

After its installation and activation you once again will have the possibility to choose whether to Show or Hide a widget but this time you can select to do this everywhere on the website. But that is not why I am writing about this plugin. Its unique feature is to target the visibility of the widget based on a specific URL or URLS. There is a clear instruction for this – you have to enter one fragment per line and if you want to target all posts within a category you have to type as you are instructed by the plugin:

Widget Context Settings

You can also write notes if your website has many users so that others can see why you have made this setting.

OK! Now since you have three great solutions that will allow you to display specific widgets on specific pages on your WordPress website, you have to come up with a plan (as mentioned above).

Create a simple mind map and match all widgets with their suitable pages. Always think of usability! Each visitor has to be offered nothing but the best website structure and content! You might want to keep all widgets to an optimal amount. Why? Because having too many widgets might confuse the visitors and also this might result in a speed reduction which is negative regarding SEO. On the other hand “optimal” doesn’t mean too few. Optimal means having the needed amount of widgets that will be of use to your visitors.

Happy planning friends and don’t forget to share which method of displaying widgets on specific pages is your favorite. You can do this in the comments below.
See you again!