+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 17

Thread: WordPress Multi-Widget Class

  1. #1
    dancole's Avatar
    dancole is offline Tavern Regular
    Join Date
    Jan 2009
    Location
    USA
    Posts
    237

    Default WordPress Multi-Widget Class

    Creating multi-use widgets is a pain... Good news is though, that WordPress 2.8 will adopt the WordPress Multi-Widget Class into core. This means creating multi-use widgets will become a breeze!

    I don't think adopt was the right word. I've looked through the new core WordPress code and it does have its differences, but it is a step forward, just a different step that what I though it would be. The WordPress ticket that got this going was: http://core.trac.wordpress.org/ticket/8441 and the new code can be found throughout: http://core.trac.wordpress.org/brows...es/widgets.php

    Since WordPress 2.7 didn't have this feature, I added this feature to my theme. I've created 6 multi-use widgets with the submitted code and I can tell you it's great. I guess I'm going to have to re-align with WordPress, however, for WordPress 2.8.
    Dan Cole, Future Engineer.

  2. #2
    Jeffro's Avatar
    Jeffro is offline WPTavern Forum Admin
    Join Date
    Jan 2009
    Location
    Ohio
    Posts
    2,107

    Default

    Does this mean that only widgets which have been designed with this class in mind can be used multiple times? It doesn't affect ALL widgets?

  3. #3
    dancole's Avatar
    dancole is offline Tavern Regular
    Join Date
    Jan 2009
    Location
    USA
    Posts
    237

    Default

    Quote Originally Posted by Jeffro View Post
    Does this mean that only widgets which have been designed with this class in mind can be used multiple times? It doesn't affect ALL widgets?
    Only widgets that have been designed for this class. If you look a particular widget's real name or even one of the classes it has, multi-use widgets will have a name such as text-375929151, while single-use widgets will have a name like calendar.

    It wouldn't be impossible to develop a WordPress function to convert single-use widgets into multi-use widgets, but I don't see WordPress developing it. There are people who see value in widgets that can only be used once...

    It's also not a class. The submitted code was, but they changed it around. It may make it more complex to understand at first, but it gets rid of some code.
    Last edited by dancole; 03-11-2009 at 10:23 PM.
    Dan Cole, Future Engineer.

  4. #4
    Jeffro's Avatar
    Jeffro is offline WPTavern Forum Admin
    Join Date
    Jan 2009
    Location
    Ohio
    Posts
    2,107

    Default

    I heard about this ticket again today and it looks like all of the default widgets will have the multi class attached to it so we can use more than one category widget if we choose to do so.

    http://wpdevel.wordpress.com/2009/03...to-the-new-wi/

  5. #5
    itsananderson's Avatar
    itsananderson is offline Big Tipper
    Join Date
    Jan 2009
    Location
    Terre Haute, IN
    Posts
    354

    Default

    I really wonder why these weren't multi widgets already!

    Glad to see this kind of thing moving forward though. It's a great step for WordPress as a CMS!

  6. #6
    Jeffro's Avatar
    Jeffro is offline WPTavern Forum Admin
    Join Date
    Jan 2009
    Location
    Ohio
    Posts
    2,107

    Default

    But if I remember correctly, weren't most of the widgets multi classed already in WordPress 2.3? I could have sworn widgets came with a drop down to select how many instances of the widgets you wanted.

  7. #7
    itsananderson's Avatar
    itsananderson is offline Big Tipper
    Join Date
    Jan 2009
    Location
    Terre Haute, IN
    Posts
    354

    Default

    I think there were a couple of them that were/are. Maybe they made some of them single widgets when they were multi-widgets. I was just getting into WordPress around 2.3, so I can't remember.

  8. #8
    andrea_r's Avatar
    andrea_r is offline WPTavern Forum Moderator
    Join Date
    Jan 2009
    Location
    Eastern Canada
    Posts
    1,279

    Default

    Only some of them, like the text widget, allowed multiples. Just a few extra lines, really.

  9. #9
    ptahdunbar's Avatar
    ptahdunbar is offline Hello World
    Join Date
    Jan 2009
    Location
    Luxembourg, Europe
    Posts
    9

    Default

    You guys should try out this free tool called widgetifyr (http://www.widgetifyr.com/) that allows you create widgets on the fly. It can generate the legacy style widgets or using the new class base approach.

  10. #10
    williamsba's Avatar
    williamsba is offline Here For The Peanuts
    Join Date
    Jan 2009
    Location
    New Jersey
    Posts
    179

    Default

    I'm really looking forward to this update. Just today I used aplugin to allow me to duplicate widgets on a site. I need to dig into this code and get familiar with it before 2.8 comes out!

+ Reply to Thread
Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts