Get your WordPress Blog to Validate

Getting your WordPress Blog to validate can be a challenge

Getting your WordPress Blog to validate can be a challenge

If you look at the bottom of CampingBlogger you will see the boilerplate copywrite information followed by a couple of weird links; XHTML 1.0 and CSS Level 2.1. These links go to the World Wide Web Consortium (W3C) who sets standards and guidelines on how to code Web pages and offers a free validation service that can check any Web page for meeting W3C standards.

If you check CampingBlogger using the CSS validation checker, you will see that it is currently failing. This is due to Joost de Valk using some CSS 3 elements in the Sociable plugin, which of course do not validate to CSS 2, the current approved standard. Indeed plugins are the bane of WordPress site validation, since the author of a plugin may or may not care about the W3C standards.

This begs the question, though, should you care about W3C standards? Run any of the top five Blogs on the Ad Age Power 150 through the XHTML 1.0 validation checker and they all fail, so it is obviously not the end of the world if your site does not validate. For those of us that do not operate one of the five largest Blogs in the World, however, W3C validation is one more feather in your cap that you are doing the right thing, which means your site will look decent in most browsers, and the search engine spiders won’t get stopped at your front door. Bottom line: it’s a personal thing.

The Sociable plugin causes CSS validation errors due to some CSS 3 elements

The Sociable plugin causes CSS validation errors due to some CSS 3 elements

So how do you get your Blog to validate to XHTML 1.0? It might validate out-of-the-box, but if you apply a new theme you might start getting errors related to unencoded ampersands. An ampersand in human-speak is simply an “&” but in XML and, hence, XHTML 1.0, an ampersand is “&” without the quotation marks, of course. If you are getting unencoded ampersand errors you can check the document.php file in {your theme}/lib/classes, and don’t confuse the PHP “&&” string command with an ampersand – those are fine!

The next fix that you will have to make, if you are using FeedBurner’s FeedSmith plugin, is to change your entire Blog from the WordPress default XHTML 1.0 Strict, to XHTML 1.0 Transitional (Wikipedia – scroll down to “DOCTYPEs and then further down to “Examples”). Somebody much smarter than me might figure out how to get the FeedSmith plugin to validate under XHTML 1.0 Strict, but I could not do it. Luckily, it is easy to change a WordPress installation to XHTML 1.0 Transitional and the FeedSmith plugin will validate just fine. You simply need to edit the header.php file and change the following line:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “”><html xmlns=


<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “”><html xmlns=

Getting WordPress to validate was much more of a chore than it was with Movable Type and, as you can see, I’m still having trouble with my CSS. Validation is largely a personal thing with me, it is something that I have always done, so it was natural that I try to do it on CampingBlogger. Since I am new to WordPress, I would sure like to hear from some experts out there on validation tips for WordPress.

See also…

2 thoughts on “Get your WordPress Blog to Validate

  1. Everyone else can, but not you. You must hit the books!

    btw – I just switched news feeds and my blog no longer validates because there are some non-UTF-8 characters in some of the article titles. I’m not going to worry about it for now. Head hurts.