Filtering my XHTML code again The past few days I have made the go ahead for myself to start with recoding everything to meet XHTML Strict 1.0 standards. Yes, it is quite a job to start with. But it gives such a feeling of satisfaction. This site was already up to the Transitional Standards so [...]
Filtering my XHTML code again
The past few days I have made the go ahead for myself to start with recoding everything to meet XHTML Strict 1.0 standards. Yes, it is quite a job to start with. But it gives such a feeling of satisfaction. This site was already up to the Transitional Standards so it wasn’t too painful a task.
Adjusting the html tags
The main issues I had to deal with were the link tags. It is forbidden to use the oh so loved “target” attribute so that had to go. At first I was fiddling with inline javascripting but that was too intense. Had to let that one go. Until I stumbled on this from the people at Sitepoint. A very nice javascript that could be used from a remote file. In the head of the page I had to call it using <script src=". Benefit is that is was there whenever, i.e. always. Secondly I had to activate the script using the onload event in the body tag. No problem whatsoever. The script does something very nice (browser independent) with the DOM. It calls a XHTML 1.0-valid attribute, which you must provide in your links, called the “rel” (relationship) attribute. Then it transforms this to the deprecated attribute “target” again but only in the background, it will not be parsed to the browser. Hence it’s validity! A few tweaks in the WordPress coding and presto. No more cumbersome extra typing those target attribs. It’s now a part of WP, voila
Ofcourse the ‘target’ deprecation is only one of many. I had to go at a load more others to get validated. You can read all of the differences at the W3C site itself to learn more about XHTML Strict 1.0 a very informative piece. Something else for a change at W3C I think
WordPress tweaks for the ‘external’ links
Again it is “Quicktags” time…Just add this code in your /wp-includes/js/quicktags.js file:
edButtons[i].tagStart = ‘<a rel="\external\" title="\External link\" href="’
+ URL + ‘">’;
But hey, how about my ‘blogroll’ list:?: There are external links there aswell. How do we modify those:?: For they are only accessible by means of the WordPress Admin sections. Not a problem. In your /wp-includes directory open the file ‘links.php’. Look for this line:
$output .= ‘<a href="’ . $the_link . ‘"’ . $rel . $title . $target. ‘>’;
at line number 243. Then modify it as follows:
$output .= ‘<a rel="external" href="’ . $the_link . ‘"’ . $title . $target.’>’;
Notice the addition of rel="external". That is the trick. All the links in the blogroll added by you in the WP-admin will now have the extra ‘rel’ attribute in them. Again, be very carefull what you do. Make backups first then go and edit.
Some pointers to get your Strict way
- Lorelle VanFossen has made it a shear quest to tell you all there is for making webpages, valid, accessible and just plain accurate. Go and have a look there. Her posts maybe quite lenghty but persisting in reading them makes one a whole lot wiser.
- Start simple. In making all the changes from, let’s say HTML 3. something to XHTML Strict might be quite a step to make. Maybe first going to HTML 4.01, then XHTML Transitional is better.
One site you will see a LOT
is ofcourse this. . . . the VALIDATOR. The hyperlink I just mentioned states /referer, that is your URL or URI or plain and simple your website’s address, i.e. “http://www.yoursite.com”. Use it well, it is a real live saver. Happy coding . . .









RSS feed







