WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Add Widget from within classed plugin

[Resolved] Add Widget from within classed plugin

  • I have a plugin (Subscribe2) that is written as a PHP class. Until now I have used the old (pre WordPress 2.8) API to add a widget but I’m trying to get up to date.

    I’ve managed to pull the widget code out into a stand alone file but I’d like to try and keep the activation option that I currently have in the main plugin class.

    How would I go about enabling (registering) the widget from within my current class? I’ve tried all sorts of code but the registration seems to fail.

    I’ve tried a require_once to the new widget file and then a register_widget, I’ve put both of this on a function within my class. Anyone any ideas?

Viewing 1 replies (of 1 total)
  • Daft error on my part – I had forgotten to require the widget file before trying to register it! 🙂

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Add Widget from within classed plugin’ is closed to new replies.
Skip to toolbar