Widgets are a very powerful part of most WordPress themes. Though many bloggers prefer to hand-code their sidebar, most eventually succumb to the ease with which widgets can be created, updated and moved. It can turn what would be a major HTML/PHP hack in the sidebar into a quick drag and drop operation.
However, widgets, out of the box, have a serious limitation. They are either always on or always off. Once you’ve set up your side bar, it will display all of your widgets on every page of your site, including pages that might not be appropriate.
What if, for example, you want to display social networking links but only on individual posts? What if you want to display a disclaimer or an information box only on your home page? Without a plugin, this isn’t possible.
Fortunately, Kaspars Dambis has created just such a plugin. Entitled Widget Context, it lets WordPress admins choose which pages their widgets appear on, giving Webmasters control over how their site looks on a page-by-page basis.
Best of all, it is a relatively “set and forget” plugin that is amazingly easy to use though still surprisingly powerful.
How It Works
Once you’ve installed the plugin, you’ll need to go to your widgets page in your admin panel, which is located under “Appearance” in WordPress 2.7. There, once you click on “edit” for any of the widgets you are using, you’ll see a new list of options below the default ones.
The first option lets you choose to either “Display only on selected” or “Display on every page except selected”. This option changes how the checkboxes below work, either either causing them to represent pages you do or do not want the widget to appear on.
From there, you can choose to either permit or allow the widget to appear on a variety of different kinds of pages including the home page, single posts, single pages, category archives and even the 404 page (see image above for more examples).
You can also choose to target the widget by the URL, thus enabling you to either put it in a specific category, year or even word in the post title depending on your permalink structure.
Finally, you can add notes to yourself about the widget. These notes will not be visible to the public and are purely to help you remember the actions that you’ve taken.
In short, by using this plugin, you can place a widget on as many or as few pages as you want. You can even display a widget on just one page or post of your site, or display it on every page save that one. The choice is yours.
There are many reasons why one would want to use widgets only on certain pages. Consider some of the following scenarios:
- Placing Digg, Reddit and StumbleUpon buttons only individual posts.
- Putting a welcome message only on the home page.
- Adding different Flickr galleries based on the category of the post.
- Removing sidebar content from pages that will likely be very short, such as attachment pages.
- Removing the recent posts widget from archive and category pages.
In short, this plugin can help WordPress users both clean up their sidebar by selectively removing superfluous information and can also clean up the layout by moving some of the information currently inserted in the template in the main content area and moving it to the sidebar when appropriate.
It is a great way to clean up the layout of your site while still getting the usability and power of a widgetized sidebar.
In the end, Widget Context is one of those plugins that almost feels as if it should be a part of the default WordPress install. Though the interface for the plugin is not the most attractive and actually breaks much of the widget panels look and feel, its features are invaluable.
For WordPress bloggers that run complex sites that need a wide variety of information in the sidebar, this plugin is almost indispensable. Without it, far more information has to either be placed into the main content area, cluttering up the reading experience, or placed needless on every page in the sidebar, making it harder for the reader to find what they want.
In short, it is good for both the sanity of the reader and the blogger, making it one of the few plugins that actually keeps everyone visiting the site just a little bit happier.