[wp-hackers] Widget definitions inside classes
Jamie Talbot
wphackers at jamietalbot.com
Sat Aug 26 01:56:41 GMT 2006
Hi,
I'd like to keep code to define a widget and its control neatly inside a class definition, but it
doesn't seem to be possible. Has anyone found a way to do this? There doesn't seem to be a
mechanism for doing so, like exists for filters and actions.
register_sidebar_widget('Languages', 'MyClass::my_language_widget');
doesn't work, and would be no good anyway as it would be a static function and there's no $this
available.
register_sidebar_widget('MyWidget', array(& $this, 'my_widget'));
like
add_filter('the_content', array(& $this, 'my_the_content_filter'));
would be useful.
Cheers,
Jamie.
--
http://jamietalbot.com
More information about the wp-hackers
mailing list