For the past few months I have used the Widget Context plugin on my WordPress blog in order to control where widgets show up on my site. Everything you see in the two right-hand columns of my site is widget-based, as are the 3 columns that display teasers for featured posts.

But I don’t want all these sidebar and teaser goodies to show up in exactly the same way on every part of my blog, which is where Widget Context comes in. It is one of several different plugins that promise greater control over where widgets appear, so that you can establish different settings for each widget.

My ideal case is a plugin that lets me determine where an individual widget appears based on my choice of:

  • page type (for example, single post vs blog page vs category archive)
  • category or tag (setting a widget to appear or hide on any post belonging to a specific category)
  • specific URL

After several months of using Widget Context I decided to try out some alternatives. Below, you’ll find my summary of how each of four different plugins works:

  1. Widget Context
  2. Widget Logic
  3. Display Widgets
  4. TS Custom Widgets

1. Widget Context

Widget Context gives you an extra menu within the configuration box for each individual widget, on the widgets page. It’s pretty much exactly what I needed, except for the fact that the “target by URL” feature is glitchy; I haven’t been able to set my widgets to show/hide by category or URL, only by page type.

If you’re only planning to control widgets by page type, this is your easiest option. If you want to control widgets by referencing specific URLs or categories, you can check out the solutions described here, but be prepared for having to find a Plan B. That’s why I tried out the plugins below.

And don’t be afraid to try out Widget Context first, and look for alternatives only if needed.Widget Context remembers the settings for each widget even if you deactivate the plugin and then reactivate it later. So you can configure your widgets in Widget Context, and if you decide to try something else, come back to Widget Context without losing your settings.

2. Widget Logic

Widget Logic uses code to customize each widget by giving you access to WordPress’ system of conditional tags. Once you activate the plugin you will see a new field inside the configuration box for each of your widgets, which you can use to enter a rule about where that widget should appear or hide.

It’s efficient but you have to be comfortable working with code, figuring out logic and looking up the numbers for any categories or tags. The easiest way to get a sense of the kind of code this involves is to look at the list of examples on the plugin’s documentation page or read this handy overview of how to use it.

For example, to get my podcast widget to show up on any single blog post in the “HBR” category, AND on the home page, I entered: in_category(711)||is_home() This worked perfectly: the widget showed up exactly where it was supposed to and the pages loaded nice and fast.

Note that any typos in your code produce ugly errors so be sure to check the posts/pages where you expect you widget to appear (or hide) to make sure you haven’t got any ugly glitches.

If you’re comfortable working with a little bit of code this may well be the option you like best. If you don’t want to deal with anything code-like, or you are planning to work with lots of category and tag rules (which will require you to look up the category and tag number each time) you may find it a bit of a hassle.


3. Display widgets

 

Display Widgets gives you a scrollbox inside each widget’s settings box, with checkboxes for each page, category or page/post type on the site. You choose either “hide on selected” or “show on selected” and then choose the pages, categories and page/post types to exclude/include.

It works, though it seemed to slow my site significantly. Some other limitations:

  • Can’t filter on tags, just categories.
  • Doesn’t work for widgets written in the pre-2.8 format. On my blog that meant it worked on “category posts” “text” and “archives”  but not “related posts” “simple image” or “find me on”, “random image”.

If you are only trying to exercise nuanced controls over widgets that are 2.8-based and therefore friendly to Display Widgets, this could be a better option that Widget Context since the category-based filtering seems to work better. But bear in mind that you have no option for controlling your widgets’ placement by specific URL or by tag. Most crucially, prepare yourself for switching back-and-forth between plugin options if it turns out that you want to control a widget that isn’t supported by this plugin.

4. Custom widgets

With Custom Widgets you start by setting up your widgets, then go to a different settings page for Custom Widgets. From there you go to the settings page for that individual widget. There are a LOT of customization options but you have to keep track of which widget you are customizing, which can be tricky if you have widgets with duplicate titles (for example, my “simple image” widget, which i use multiple times.) Note that this is an older plugin so may not work with upcoming versions of WordPress.

It works but it is a VERY cumbersome configuration process. Personally I find the idea of learning enough PHP to use Widget Logic a lot less daunting than using Custom Widgets. It’s hard for me to imagine a use case for this plugin, unless you are (a) customizing only one or two widgets, (b) totally unwilling to do any coding as required by Widget Logic, and (c) desperate to limit a widget’s appearance by category or tag (which is what doesn’t seem to work in Widget Context.)

Results

Widget Logic is the best option in terms of getting the display results I want; Widget Context is the easier plugin to configure. So why choose? I have activated both plugins and it’s relatively easy to use them together.

Just use Widget Context for any widget you want to customize by page type (for example, show only on category archives) and then use Widget Logic if you want to customize by category, tag or URL.  When you’re using Widget Logic to control a widget, just leave the Widget Context options set to “Hide on selected” and leave everything unchecked.

Don’t try to combine the two plugins on a single widget; I tried a variety of combinations and found that I couldn’t get the results I wanted by combining the two. But I tested pages that had some widgets controlled by Widget Logic, and others combined by Widget Context, and everything behaved as intended.