How To Add Category Specific Widgets In WordPress

category specific widgets featured

Widgets are definitely one of the great things about WordPress.

Unfortunately, many users use widgets without really realizing their true potential which results in a cluttered sidebar, or two; depending on your theme.

Luckily there is a solution right within your WordPress dashboard and that solution comes in the form of the JetPack module called Widget Visibility.

That little module alone allows you to display certain widgets on certain posts or pages – basically it gives you a fine level of control of your widgets and where you want them displayed.

With this module activated, there is no limit to the amount of “different” sidebars you can have.

You can display certain widgets on your front page, a different set of widgets on your About page or Contact page and a completely different set of widgets on your posts, or specific categories.

Let’s see how to do it!

Adding category specific widgets in WordPress

First thing you need to do is install JetPack plugin if you don’t have it installed already.

If Jetpack is already installed on your site, then you are good to go.

Step 1: 

The first thing you need to do is log in to your Dashboard, hover over JetPack and go to Settings.

Scroll down till you see Widget Visibility. Click on the module name and click on Activate:

step 1 widget visibility jetpack

Step 2: 

Now that you activated the module, let’s see how to display widgets only for certain categories.

Let’s say you want to display more posts from the same category on a single post from that category.

The easiest way to do that is to first create an image for your category (something simple in Picmonkey will do) and upload the image to your media gallery.

Then grab the URL of the uploaded image.

step 2 image url

Step 3:

Next, head over to Appearance > Widgets and drag the Image widget to your sidebar.

Fill out the fields for image URL, and the image size to make sure it displays correctly. In the field that says Link URL (when image is clicked) enter the link to your desired category.

step 3 adding image widget

Now comes the fun part!

Step 4:

Click on the button that says Visibility and select Show. Change the desired widget type from the drop down menus. Then click Save.

step 4 controlling visibility

And that’s it! Now the widget will show up only in posts that belong to the specified category.

Visibility is controlled by five aspects: page type, category, tag, date, and author.

For example, if you wanted the Author widget to only appear on that author posts choose “Show” from the first drop down and then add two rules: “Author is” and “your desired author.”

Similarly, you can also choose to hide certain widgets from certain pages.

Like with the above example of Author widget, you can choose to Hide it on your About page because it really makes no sense to have it displayed there. In this case, you would change the first option of Show to Hide, and then select Page is and then selecting the corresponding static page from the last drop down menu.

Each visibility rule is handled separately. There isn’t a way, for example, to only display a widget on posts that are categorized as “Recipes” and also tagged with “Breakfast Ideas.” You can only choose one or the other.

Related reading: Is WordPress Jetpack Worth The Convenience?