Jonathan BaileyPutting Widgets into Context

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

widget-contextOnce 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.

Potential Uses

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.

Bottom Line

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.

Follow this blogger on Twitter!

Jonathan Bailey Written by Jonathan Bailey from Plagiarism Today
Posted on February 10th, 2009 and filed under Blogging
Do not forget to subscribe to our RSS feed for updates
  • Digg This Post
  • Tweet This Post
  • Stumble This Post
  • Submit This Post To Delicious
  • Submit This Post To Reddit
  • Submit This Post To Mixx
  • BloggingTips Uses Aweber

7 Responses to “Putting Widgets into Context”

Author comments are in a darker gray color for you to easily identify the posts author in the comments

  1. streaming says:

    Congratulation,
    today you won a new reader :)

  2. Nice plugin… But is there a way that i can make those widget bet smaller? i think it wont fit with my theme.

  3. taofei says:

    Very good! Wish Publicate more good things

  4. Kaspars says:

    Jonathan, thank you for such a great review of my plugin. Regarding your comment about the design — do you have any suggestions on how to make it feel more native to WP?

    Also, which browser are you using? Maybe you could email me a screenshot of the widget page which illustrates the rendering issues you had.

  5. Kaspars: I don’t think that the problem is yours actually. As you can see on the screen shot on your own site, the options created by your plugin create a very wide box that goes outside the bounds of the usual widget editing pane.

    The only solution I would have for you is to say “use less information” but that is outright stupid. You could try to squeeze it into a more vertical format but that would make it harder to use.

    Honestly, I don’ think either solution is worthwhile. The way you have it now is fine and I think the onus should be on the WP guys to make that box expand more neatly. If they did that, it would work well.

    So don’t lose any sleep over that, you’ve created too good of a plugin!

  6. Pushkar says:

    Great tip, would help immensely in the future. Hope blogger too comes up with some plugins like these. All those coding tips are fine but at the end of the day if some thing goes wrong you are doomed. That’s why i like wordpress but unfortunately my older blog is on blogger.

Trackbacks

  1. [...] Putting Widgets into Context [...]

Comments are closed.

Comments are closed since this post is older than 30 days. However, you can continue this discussion in our popular Blogging Forums

Subscribe To BloggingTips Via RSS Subscribe To Blogging Tips Via Email Follow Us On Twitter Follow us on Facebook Find Out More About Our Newsletter

Sponsors

Blogging Tips Newsletter

Our WordPress Themes

 

Our Free E-Books