SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist happyoink's Avatar
    Join Date
    Jan 2008
    Location
    UK
    Posts
    503
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry Issues with head not validating

    Okay, I'm still working on my WordPress theme. The problem is, the default WordPress header.php has PHP code inserted such as:

    HTML Code:
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    Now, I copied and pasted the code from the default header.php (minus the stuff between the <style</style> tags because I didn't need them) into my header.php file. When I ran my markup through the validator at W3C, the validator found no problems with my markup, except for the stuff in between the <head></head> tags. I tried to correct the errors which included escaping the < character i.e.

    HTML Code:
    <link rel="stylesheet" href="&lt;?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    if the PHP was enclosed in "" like in the above example. Of course, in my browser, the CSS stylesheet refused to load even though the validator insisted that escaping these characters was the correct thing to do!

    How do I get the validator to play nicely with WordPress?

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    16,449
    Mentioned
    160 Post(s)
    Tagged
    1 Thread(s)
    The validator should not see the PHP tags. Are you doing "validate by URI"?
    Or trying by "validate by File Upload" or "validate by Direct Input"?
    The validator is not a PHP parser, but an HTML validator, so it should only be checking HTML, that is, the output of the PHP file.

  3. #3
    SitePoint Evangelist happyoink's Avatar
    Join Date
    Jan 2008
    Location
    UK
    Posts
    503
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah that would explain it - I was using the direct input option. It validates when I use the validate via URI option.

    Thanks.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •