Widgets are an extremely useful way to customize a WordPress theme to your liking. But what if you want to display a widget only on certain pages? Or what if you want to hide a widget on posts in a particular category? For years, the best way to handle fine-grained widget management was with the Widget Logic plugin. But not anymore.
Read on to find out how Automattic‘s Jetpack plugin has taken center stage, precluding the need for its single-use predecessor.
Managing Widgets with Widget Logic
Widget Logic is a brilliant plugin. It provides a straight-forward interface for managing when and where your widgets show up in your WordPress theme.
Widget Logic is part of the official WordPress plugin directory, so acquiring it is very easy. Simply go to the plugins area of your WordPress dashboard. Click “add new” and search for the plugin by name: “Widget Logic.” Click “Install Now,” and after the installer runs, click the link to activate the plugin.
Once the plugin is installed and activated, it adds an additional area for configuration in the widgets area of your WordPress dashboard.
This new configuration allows you to specify where you want the widget to appear. The hard part is figuring out how to write the configuration.
The plugin uses WordPress PHP functions to control widget visibility. For instance, if you want a widget to show up only on the home page, you would put this command into the Widget Logic box:
If you want the widget to display everywhere except on the home page, you use the ! to negate the rule:
More complex directives can be configured using additional punctuation to add multiple rules together. Click here for more examples.
The plugin was solving the problem; it provided a way to control widgets without hacking the theme code. But the issue was that you still had to figure out how to write WordPress PHP functions in order to use the plugin.
Jetpack Does it Better
Automattic (the company behind WordPress.com and many other things WordPress-related) took this concept and gave it an overhaul in their Jetpack plugin. You can still control where your widgets appear, but with Jetpack you no longer have to learn how to write PHP functions.
The Jetpack plugin is also in the official WordPress plugin directory, so installation is almost the same as with Widget Logic. Search the plugin directory and install it.
Once the plugin is installed and activated, you get a handy addition to your dashboard menu, and a page full of features, including Widget Visibility.
If the feature isn’t activated already, simply click on “Learn More” and then “Activate” to turn it on.
Now when you go to your widgets page, you get a new configuration option at the bottom of your widgets.
Instead of having to blindly type in the function yourself, hoping that it wound up doing what you wanted it to, the Jetpack Widget Visibility feature allows you to use dropdown selectors to choose where you want your widgets to show up. You can show or hide based on category, author, tags, date, or by which page it is or what type of page. And if you need to add more than one rule, you don’t have to use programming punctuation — just click the link to add another rule.
This interface makes the plugin much more accessible for code-averse users, which is just how it should be. You shouldn’t have to know how to code to use WordPress. Widget Visibility in Jetpack adds one more layer to user-friendliness in WordPress.
I feel bad for Alan Trewartha. He no doubt spent a lot of time creating, maintaining, and improving Widget Logic. And it was probably his plugin that inspired Widget Visibility in Jetpack. But now that Jetpack does the same thing, and does it so smoothly, Alan’s plugin has become redundant. So “farewell” to Widget Logic, and a hearty welcome to Jetpack.
If you need help setting up Jetpack or any part of your website, click here to contact me. For more articles about WordPress and internet marketing, click here to follow Avid Netizen on Twitter and click here to sign up for the newsletter.