Archive for June 1st, 2007

Wordpress 2.2

Friday, June 1st, 2007

Not exactly news but, 17 days ago Wordpress 2.2 was released. Just a few days ago, I upgraded to this version. I actually didn’t mean to but a debacle I made while doing some maintenance forced me to do so.

There are a lot of fixes in this version, but the best thing is that widgets are a core part of this release. You don’t need the widget plugin anymore, but your old widgets may not be compatible with 2.2. I found that for plugins that pass parameters to widgets at registration time, won’t work. Apparently the signature for ‘register_sidebar_widget’ has changed. It now has 4 parameters instead of 3.

The old signature looks like this:
void register_sidebar_widget ( string name, callback [, string classname ] )

The new looks something like this:
void register_sidebar_widget ( string name, callback [ x, [, string classname ]] )

Notice that there is a possible new parameter but, it is not added at the end but before the classname param. If you are calling it the old way your value won’t get passed in. And if your widget code is expecting a parameter it will error out. Passing in a null value for the third field, fixes this problem. Like so:

register_sidebar_widget(array("BTW '$title'"), array('BH_Text','widget'), null, $title);

I don’t know what this new param, is used for yet.

Share and Enjoy:
  • del.icio.us
  • Reddit
  • Digg
  • Slashdot
  • StumbleUpon
  • Facebook
  • Google
  • Technorati
  • Live
  • e-mail