Support » Plugins » Hacks » Updating old widgets to the newer API

  • There are a few plugins I use, as well as old projects, that used the old widget API calling on
    register_sidebar_widget('NAME', array('ID', 'widget'))
    register_widget_control('NAME', array('ID', 'control'))

    I would like to convert them over to the newer widget API to allow their use across multiple widget areas. My various attempts in trying to follow the documentation and examples of newer code have resulted in just no widget showing up or a white screen of death. Does anyone have any pointers? Any links to good tutorials or examples of upgrading the code?

    I’m happy to repay the help by contributing back to the community. If I get it down, I’ll bring some of the otherwise functional old plugins up to the new widget API and HTML validation (insufficient image tags are common in old plugins).

Viewing 2 replies - 1 through 2 (of 2 total)
  • Any development on this? I’m also looking to do some work here.

    I think I figured some of it out already.

    I was looking for a “Recent Photos” using the media library and it was 2 years out of date. I’ll post some snippets to hopefully help you (and others) out.

    function rp_widget_Admin(){ //Form Code }

    function form($instance) { //Form code }

    Any variables, make sure they are placed in the $instance[''] array and called correctly. What I was using had global $settings = get_option("widget_option");

    I just replaced any $settings tag with instance[‘VarName’].

    Hope this will help to an extent feel free to contact me if you have some questions.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Updating old widgets to the newer API’ is closed to new replies.