What are WordPress Widgets?

By Andy

I’m not a big fan of newspapers. Planets will line dance before I read more than a handful of column inches in any given rag. One of my beefs with print media is that I can’t customize it. Sure, I can tear up a newspaper and shuffle the parts around on my kitchen table but the parts never fit together again.

Enter WordPress Widgets. A few hours ago, Matt launched this little feature that we designed and I wrote. This may not be a time for comparing small steps to giant leaps but it’s still pretty cool. Widgets are sidebar elements that you can move into or out of, up or down your sidebar any way you like. This sidebar thing is starting to sound like fun!

Matt mentioned that we’re taking requests and opening an API. Of course, not every request can be honored but we’ll try to include the most popular wishes as time goes on. This is part of what’s so nice about having an open API: any programmer can write a widget. It’s really just a mini-plugin.

Programmers: before you get all excited about writing the next big sidebar widget, you should know that the API (which is painfully simple) isn’t done yet. This is mostly due to the differences in sidebar markup between themes. We’re beefing up the API to handle this diversity but rest assured that the API will be very familiar: write a function or two, use a couple of new hooks, stick a fork in it.

15 Responses to “What are WordPress Widgets?”

  1. CarLBanks Says:

    These widgets are awesome! I just think we need del.icio.us and Flickr widgets!

  2. vertino.blog Says:

    WordPress Widgets

    Exciting stuff with the WP.com admin tools… Andy Skelton has developed a widget framework that enables customisation of the sidebar template.  I’ve been quite frustrated with the lack of customisation of the little things; specifically how…

  3. BillyG Says:

    I’ve been looking for 10 minutes at all these connected blogs and haven’t seen a widget link yet.

  4. Lorelle on WordPress » Playing with Wordpress.com New Sidebar Widgets Says:

    [...] There have been a few recent announcements about the WordPress.com Sidebar Widgets lately, especially from WordPress developer, Andy Skelton, and in the WordPress.com Blog, so what is all the fuss about? [...]

  5. Weblog Tools Collection » WP Sidebar Widgets Says:

    [...] WP Sidebar Widgets WordPress.com introduced new sidebar widgets and Lorelle has a nice writeup on what they are and how to use them from a users’ perspective. Technorati Tags: wordpress widgets   [...]

  6. AjAxed Says:

    Any chances we can get them in the downloadable version of WP too :)

    I really hope so!

  7. Joe Says:

    Will the be avalible for the non-wordpress.com blogs ? It would be great !

  8. Ajay Says:

    Andy,

    What do I as a theme developer need to do to ensure that I can make an editable sidebar, so that widgets can be used on it?

  9. eduo Says:

    I second Ajay’s question. And the theme I had probably in mind to do this was Ajay’s too. Hah!

  10. Andy Says:

    I’m working on a release of the plugin so everyone can see the code, as well as API documentation. It’s really not difficult.

    Here is a piece of advice though: make your sidebar one giant unordered list. Don’t use divs. sidebar.php should look like this (pardon the lazy brackets):

    [ul id="sidebar"]
    [?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(1) ) : ?]
    {insert non-widget sidebar list items here}
    [?php endif; ?]
    [/ul]

    Then this must go in functions.php:
    if ( function_exists(‘dynamic_sidebar’) ) :
    register_sidebar(1);
    endif;

    Building your sidebar any other way will force you to do more work to make it work. Creating multiple sidebars is easy, however. You’ll see it in the docs later this week. For a sample, switch to the WP-Andreas-09 theme.

  11. Walter Jeffries Says:

    I have the same question as Ajay. I have my own theme and want to make sure it is compatible with sidebar widgets. I also look forward to learning about the API as it settles down. Keep us posted Andy!

    -Walter
    http://NoNAIS.org

  12. charactor Says:

    Same complaint as BillyG: I find lots of links talking about widgets, but where are the widgets themselves?

  13. WordPress Widgets » La mate por un yogur Says:

    [...] Hacía semanas que se venía hablando de los Widgets para WordPress en distintos blogs relacionados con el CMS y de su implementación en el servicio de wordpress.com. [...]

  14. Stupid Wordpress Tricks » Widgets: Are They In Your Future? Says:

    [...] Widgets, as sidebar accessories, were written by Andy Skelton, one of the WordPress original developers, based on input from Matt, the Father of WordPress. It’s a great idea: instead of learning PHP, changing sidebar.php, and thus restricting the ability to support the sidebar among different themes, why not have a visual way to drag and drop “widgets” into the sidebar? [...]

  15. Take the Web » Tweaking Wordpress - plugins, widgets, themes Says:

    [...] I also experimented with Widgets. It took me a while to figure out whether Widgets were just for WordPress.com hosted blogs (see sidenote, left) – I could only seem to find old posts on the matter – but eventually I discovered that Widgets are now available for self-hosted WordPress blogs too, with the help of the Automattic plugin. [...]

Leave a Reply