WordPress Widgets

This weekend, I decided to edit my custom sidebar code to be compatible with WordPress Widgets, which is:

designed to provide a simple way to arrange the various elements of
your sidebar content (known as “widgets”) without having to change any
code.

WordPress v. 2.2 has the capability built into the core code. Earlier versions require using a plugin.

Since I have a really long sidebar already, I am unlikely to be installing many widgets onto it. The greatest benefit to me will be that it makes maintenance much easier. If I want to add, remove, move things around in my sidebar, it’s a matter of drag-and-drop, instead of handcoding changes.

Also, the same sidebar will show up in every theme that is compatible with Widgets. Previously, I used a global file that contained the sidebar code, but I would still need to edit the sidebar code of each theme to include the file. Now I can be lazy and not do it. It would also make updates easier since I can just overwrite the themes that I don’t customize without having to redo that change every time.

Another bonus is that some of the Widgets are configurable with options. For example, the category list by default does not show anything besides the names of the categories. The options let me add the posts count and show the hierarchy. Previously, I would have had to modify the code, after finding what code to use.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>