design, wordpress

A Temporary Fix to Keep WordPress XHTML Friendly

Today I discovered two bugs in wordpress that keep it from being valid xhtml. They don’t happen in all occasion, but I was lucky enough to hit both with a project I was working on.

The first bug happens when you are using the links widget and have more than one category of links. What you get is multiple items marked with the same id. That is a no-no. Fortunately a kind person offered a fix right in the comments of the bug report.

Here’s a stupid simple fix. Add this right before the call to wp_list_bookmarks() in [widgets.php]:
$before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget);

The second bug is when the Archives widget is used and the “Display as a drop down” option is checked. The problem is that it uses “onChange” when it should use “onchange.” To fix this just do a search & replace in the widgets.php file.

I love WordPress, and I am glad that these fixes were easy, I hope that they (along with some of the other xhtml issues) get sorted out in the next release. If they don’t you’ll have to reapply these changes every update until they do.