Making DynamicWP's Simple White Theme XHTML Compliant

by @edent | # # # # # | 2 comments

This blog is proud to be XHTML 1.0 Strict Compliant.  Just like it is polite to use correct spelling and grammar for human readers, I believe that correct markup is "polite" for rendering engines.

I've recently started using DynamicWP's Simple White Theme.  The theme is excellent, but generated around 60 validation errors.  Luckily these were caused by a scant half dozen errors in the source code.
Screenshots of the theme
Here is a quick summary of the errors, why they need to be fixed, and how to fix them.

footer.php - line 8
Why: Target isn't a valid XHTML attribute
From: <p>Powered by <a href="http://www.wordpress.org/" target="_blank">WordPress</a> | SimpleWhite by <a href="http://www.dynamicwp.net/">Dynamicwp</a></p>

To: <p>Powered by <a href="http://www.wordpress.org/" >WordPress</a> | SimpleWhite by <a href="http://www.dynamicwp.net/">Dynamicwp</a></p>
index.php - line 63
Why: The & symbol should be escaped to &amp; when used in URLs. The element needs to be closed. The alt attribute needs to be included.
From: <img src="<?php bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo catch_that_image(); ?>&w=275&h=120&zc=1">
To: <img src="<?php bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo catch_that_image(); ?>&amp;w=275&amp;h=120&amp;zc=1" alt="" />

line 69
Why: The element needs to be closed
From: <hr>
To: <hr />

sidebar.php - line 24
Why: The element needs to be closed
From: <img src="<?php echo catch_that_image(); ?>">
To: <img src="<?php echo catch_that_image(); ?>" />

line 26
Why: The & symbol should be escaped to &amp; when used in URLs. The element needs to be closed. The alt attribute needs to be included.
From: <img src="<?php bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo catch_that_image(); ?>&w=40&h=40&zc=1">
To: <img src="<?php bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo catch_that_image(); ?>&amp;w=40&amp;h=40&amp;zc=1" alt="" />

line 29
Why: The alt attribute needs to be included.
From: <img src="<?php bloginfo('template_directory'); ?>/images/noimagesmall.jpg" />
To: <img src="<?php bloginfo('template_directory'); ?>/images/noimagesmall.jpg" alt="" />

line 42
Why: Error.  The <ul> should be </ul> to close the list.
From: <ul>
To: </ul>

2 thoughts on “Making DynamicWP's Simple White Theme XHTML Compliant

  1. Michael Brunton-Spall says:

    You've changed the behaviour with your first change. It used ot open the link in a new window, and by removing the target you broke that behaviour. You can work around this with javascript or CSS3 in compliant browers using the target-name, target-new, target-position css styles.

    You should also use your alt text to describe to a visually impaired user what your image actually represents rather than an empty string.

    1. Hi Michael,

      I'm aware of the change of behaviour. I think that it should be up to the user whether they want to open a site in a new window or tab. I'm not a fan of sites which assume they know better than the user.
      Regarding the alt text - yes, it should contain details of the image. All I've done is a kludge to make the page validate. I'll look in to drawing out the alt text (if any) from the database.

      Thanks for your comment.

      Terence

Leave a Reply

Your e-mail address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.