How To: Create More Flexible Widgets

WordPressThis is not going to be one of those posts about how to widgetize your sidebar because frankly, if by now you still are not using a theme with widgetized aeras you need start looking for one. This post is about how to use those widget area’s in the smartest way possible.

When I say sidebars, I don’t necessarily mean sidebars. Widget areas are of course not limited to the visual sidebars in a theme. Most themes have one or two sidebars and a matching 1 or two widget areas, but some themes have just two sidebars, but a total of 13 widget area’s.

The problem, even with two sidebars, is that you have very little control over which widget goes on what page or post.. or category or archive even. Luckily there are two plugins that can help us out here. Widget Logic and Section Widget. Both widgets do pretty much the same thing, be it that Section Widget is a lot easier to use when you’re not very familiar with Conditional Tags.

Widget Logic

Widget Logic gives every widget an extra control field called ‘Widget logic’ that lets you control the pages that the widget will appear on.

There is also an option to add a wordpress ‘widget_content’ filter — this lets you tweak standard widgets to suit your theme without editing plugins and core code. Do check out the FAQ for this plugin for extra insight on how to use this plugin.

Section Widget

Ever wanted to display a widget only on the front page? Subpages of certain pages? Posts with a certain tag? Section Widget‘s got that covered. With a very easy to use interface, you can create your section-specific widget in no time – without going through the frustration of writing PHP code.
In addition to plain text and HTML, Section Widget has also made it possible to use shortcodes in your widgets.

On top of that Section Widget adds a tabs functionality to the equation which is really helpful to keep your sidebar less cluttered. It even comes with 25 bundled themes. No wonder Section Widget won the WordPress Plugin Competition in 2009.

How to Have Even More Fun With Widgets Areas

WordPress Widgets
The two afore mentioned widgets let you be very creative in what type of content you want to display in on which type of page, but there are a few more specific plugins I want to run by you. These plugins do different things, but all of them are perfect when you need them. Combined they make for the most flexible widget experience possible.

Exec-PHP

Exec-PHP allows you to execute PHP code in the excerpt and the content portion of your posts and pages and your widgets. Using this plugin should be done by someone who knows what he’s doing with PHP and that’s why you can restrict  the execution of PHP code to certain users by using roles and capabilities.

WYSIWYG Text Widget

The WYSIWYG Text Widget allows you to do with text widgets what you do when writing posts and pages.  This means you can add colors, links, and even images to your sidebar without knowing code.

Tabbed Widgets

A different version to the Tabs used by Section Widgets is Tabbed Widgets. Tabbbed Widgets lets you use other widgets for the tab content and specify a custom tab title. Other features are:

  • Make tabs rotate in a set interval so that they become more noticeable and prominent.
  • Set a random start tab on each page load so that all tabbed content gets equal exposure.
  • Make unlimited number of tabbed widgets that can be then used as regular widgets via the Widgets menu.

Widgets Reloaded

The default WordPress widgets don’t offer much control over how they are output on the screen. Widgets Reloaded is was created by Justin Tadlock to take of any shortcomings the default widgets might have .

Widgets Reloaded replaces many of the default widgets with versions that allow much more control. Widgets come with highly customizable control panels. Each widget can also be used any number of times. The following widgets are replaced: Archives, Authors, Bookmarks (Links), Calendar, Categories, Pages, Search and Tags.

Query Posts

This last widget I’d like to mention is called Query Posts. Also created by Justin it alllows users that don’t know their way around PHP to easily show posts in any way they’d like. It’s like having a cool WordPress developer as a friend ready to do your bidding.

The widget has over 40 options to choose from. You can list posts by category, tag, custom taxonomies, author, date, time, name, or anything you can imagine. You can choose to show the full content, excerpts, or even a simple list. You can order the posts in all sorts of ways. You can even show pages.

So there you have it. A list full list of plugins to suit your every widget need. I’m curious to learn what widget area enhancing plugins you use I haven’t mentioned here. Do tell!

This article first appeared on BloggingPro:How to Create the Most Flexible Widget Areas in Your Sidebars

Leave a Reply