What are WordPress Widgets?

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.


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

  2. BillyG

     /  March 11, 2006

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

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

    I really hope so!

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

  5. 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?

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

  7. 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; ?]

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

    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.

  8. 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!


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

  1. Lorelle on WordPress » Playing with Wordpress.com New Sidebar Widgets
  2. Weblog Tools Collection » WP Sidebar Widgets
  3. WordPress Widgets » La mate por un yogur
  4. Stupid Wordpress Tricks » Widgets: Are They In Your Future?
  5. Take the Web » Tweaking Wordpress - plugins, widgets, themes

Get every new post delivered to your Inbox.

Join 1,950 other followers

%d bloggers like this: