[wp-hackers] WP 2.2 Widgets Issue / Fix

Martin Fitzpatrick martin.fitzpatrick at gmail.com
Thu May 31 13:14:05 GMT 2007

On 31/05/07, Knut-Olav Hoven <hovenko at linpro.no> wrote:
> On Thursday 31 May 2007 14:51:23 Martin Fitzpatrick wrote:
> > Is there a simple way to tell, from a plugin, whether the current
> > theme supports Widgets?  I think that would be the equivalent
> > functionality I was looking for.
> I understand what you mean, but I don't understand why you would want to test
> on that (unless you are making a theme-validation plugin).

The original reason for doing it was that a number of my plugins are
widget-plugin hybrids in that they can be used either way.

If a plugin is installed as a widget it didn't seem to make sense to
have the options under Options->etc. when there is a configuration
panel on the widget itself. It takes up room and means that when
setting up the widget you're asking users to go to two places to do
one thing.

Originally the widget-plugins used to detect whether widgets were
enabled and output the control form into the widget if they were, or
under Options-> if not.

Saying that, this adds a whole extra set of usability problems / bug
reports from people asking "I'm using the code, where do I configure
it?" because they've also got Widgets installed. Hence the reason I've
pulled all this code out of the plugins now!

> You should register the widget anyway, either it is being called for (if the
> theme supports it) or it's not. Your plugin should also have a convenient
> function for use in themes that doesn't support widgets. That should be
> explained in a readme/install file.

As mentioned above this is the way I've gone about it, while also
moving the configuration options/etc. under Options->etc. to clear
things up.

I guess with this out the way there really is no reason to check
whether the current theme supports widgets or not.... so I'll stop

Thanks again for the all help,


More information about the wp-hackers mailing list