Support » Plugins » Add Widget from within classed plugin

  • Resolved mattyrob


    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 ‘Add Widget from within classed plugin’ is closed to new replies.