Making your WordPress website W3C validated


Previously, we discussed the importance of W3C validation and SEO and shown examples of our websites of both errors, validated and errors which can be corrected. This time we will discuss on making your WordPress website W3C validated; well you might end up with 12 errors; but it is much better than your 80 error for sure.

html5-logo

To comply with W3C standards for your WordPress website, you must take into account several parameters:

 

Declaring a doctype

 

This declaration is found in the header.php file in WordPress. The doctype is the first line of your HTML page, this declaration allows us to know the search bots how HTML is has been used. If you declare a W3C doctype, it must conform to the specifications of the latter, if in doubt about using the code, only the official documents are authentic.

The three statements most used at present are XHTML 1.0 Transitional (this language is officially abandoned, but read our note later), XHTML 1.0 Strict and HTML5 (replacing the HTML4 and XHTML).

Here is our doctoype:

 

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” dir=”ltr” lang=”en-US”>

 

We were saying before to read note later, the note is that, if you see in W3C validation that, declaration as Transitional  generating less error or even validating it than your native Strict (you can force in W3C tool like the below screenshot), simply go to Theme editor and change it.

 

Making your WordPress website W3C validated

You can force change the doctype to test in W3C tool

 

This is not cheating or any fraud method, it is the Theme creator (or other plugins and gadgets you use) who have used a mixed up code. As you can guess from the name, Strict is strict and Transitional allows older HTML codes like target=”_blank”. It is almost an impossible work (for non developers like me) to and mantain WordPress doctype Strict, because WordPress itself adds those old codes from the writing panel.

 

The presentation of content with style sheets (CSS)

 

This is important. Each HTML page containing texts and images is attached one or more cascading style sheets (or CSS). The stylesheet also follows strict recommendations. Follow these recommendations can be assured that the site displays correctly on all . This can be checked from W3C CSS validation.


Though it seems very tough job, practically there is for relatively noob user on programming side. It is the style.css file in your theme that mainly we will think of. This is why simple coded theme platform such as Thesis platform or Genesis works great. They have mainly one CSS file plus only the Child theme’s stylesheet will be used practically. So, if you can code or modify any child theme, it will have less error.

In any case, copy the full Stylesheet after opening in Notepad or any Text Editor and clean up using Clean CSS. Those are regular reader of this website knows that we written ago about how to install WordPress offline for testing. Use that installation for testing the new corrected CSS. Do not change the header part of CSS file that says the name of the Theme, otherwise it will be a mess.

 

Architecture and Semantic HTML

 

Here is needed reference of 500 pages written by W3C, we can feel the thing that are coming in your mind if you are not a developer. Just scan it if you can understand things a bit on the first look. Necessity is the mother of not of only invention but also understanding! When you will understand tweaking in their way helping your website, you will be interested to understand.

 

Understanding the W3C validation report and correcting your WordPress website

 

This is difficult to do for CMS platform like WordPress. This is how we have corrected our other website:

 

  • Understand why the validation tool is marking a red mark. Search for it.
  • Your theme, without any plugin, gadgets should be by default valid. Otherwise you will get mad but can not correct anything. It is something like trying to straighten a dog’s tail. Before buying go to the demo page; copy paste the url to W3C validator to check. This is not fool proof due to several reasons, but a theme with 80 errors should make you thoughtful.
  • Yahoo site meta tag will caught by validation tool as error (so three errors corrected). Simply remove it after few weeks after validation or upload HTML file to your root.
  • Do not copy paste Facebook code from Facebook developer API. Use some facebook plugin (two or three errors corrected).
  • Some Advertisers have incorrect / invalid code : so it is question of compromise.
  • Use xHTML compliant codes (tracking for example) instead of default codes; they offer such option too.
  • Plugins: You have to identify which plugins are pumping invalid codes. Remove them.

 

 

Signature


Incoming search terms:

wordpress w3c,w3c wordpress,w3c wordpress theme twenty,wordpress site validation,w3c wordpress com errors,wordpress w3c auto correction,wordpress w3c site testing,wordpress w3c template,wordpress w3c tutorials,wordpress w3c validation errors,change language declaration wordpress,w3c validator wordpress themes,edit w3c code for wordpress,fix w3c error wordpress template,get validated w3c wordpress template,how do i declare site language in wordpress,how to validate w3c to a wordpress sites,w3c compliance wordpress,w3c theme wordpress,w3c validation and wordpress
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.
About Abhishek

Abhishek Ghosh is an Orthopedic Surgeon, Inventor with 216 Patents, Current editor of The Customize Windows Media Group. You can follow and know more about Dr. +Abhishek Ghosh on Google Plus and follow on Twitter as @AbhishekCTRL.

Comments

  1. Ankit Singh says:

    This is best one article so far I have read online. I would like to appreciate you for making it very simple and easy. I have found another nice post related to this post over the internet which also explained very well. For more details you may check it by visiting this url.

    http://thecustomizewindows.com/2011/04/making-your-wordpress-website-w3c-validated/

    Thanks

Trackbacks

  1. [...] or on site SEO should be done with greatest importance. This includes W3C validation, Page Speed, Good internal linking strategy, avoiding duplicate content issues, writing unique [...]

Speak Your Mind

*