February 16, 2012
The W3C compliance quest

I like my wordpress blog to have neat plugins, modern sharing tools and whimsical widgets, but I also run a tight ship around here when it comes to W3C standards compliance. Here’s a few of the battles that I’ve fought in the name of having my cake and eating it, too. I’m shooting for xhtml 1.0 transitional, so if your website does too, and you use any of these tools, I’ve already done the work for you for free. Don’t be scared to shower me with compliments and affection if following any of this advice turns out well for you.

However, this battle is not over. My site is almost always in flux and I will continue to update this list as new problems arise or in fact, if anyone out there is reading and has some of their own; include your fixes in the comments! Now, on to the meat; Have a happy, standards-compliant crusade. :)

Twitter widget Pro ( Version 2.3.8 )
problem: The link tags are given a bad attribute
solution: In the file: falldeaf-content/plugins/twitter-widget-pro/wp-twitter-widget.php commenting out lines 611 and 650 ( $linkAttrs[‘data-lang’] = $lang; ) will prevent the attribute ‘data-lang’ from being inserted in the tags.

Adding html into your documents
Problem: WordPress’ visual editor infamously adds P tags all over the place, this plugin will ensure the output is exactly as you specify
Solution: Use the plugin – ml raw html (http://wordpress.org/extend/plugins/ml-raw-html/)

Youtube video embeds
Problem: Using WordPress’ auto-embed of youtube videos (which is technically youtube’s fault) creates a plethora of compliance problems
Solution: Here’s an article with a code snippet that will allow you to embed youtube videos in a standards compliant way – http://www.bgevolution.com/blog/w3c-xhtml-youtube-video-embed/ if you’d like to do it manually.
For a nice, standards compliant, automatic way of doing it I used the plugin Advanced Youtube: http://wordpress.org/extend/plugins/advanced-youtube/ though I edited the reg-ex a bit so that It would find and use youtube links automatically instead of needing tags. To do the same for the version last updated on 5-18-2010, change this line:

to this:


Hey thanks for reading this far! Maybe you'll be interested in more of my projects? Check out my homepage :)

Post a Comment

Your email is never published nor shared. Required fields are marked *