• Resolved redsentence

    (@redsentence)


    Hi,
    I am getting an invalid markup warning on the code surrounding the post category on the blog archive page – rel=”category tag” is causing it, any ideas where I can edit this?

    Thanks!
    Jason

Viewing 7 replies - 1 through 7 (of 7 total)
  • Are you getting this when you run the W3C validator? I get these as well on other themes. I just tested the Twenty Twelve theme and it does that too. I think that in this case, the code may not be valid according to that validator, but I think that it’s ok. I think that there’s been so much change with HTML/HTML5/ media queries etc.. in the past few years, but the W3C validator has remained the same. I might be wrong, but I personally just ignore these errors.

    I don’t think that the errors come from the theme, so there’s no easy way to fix these.

    I agree with Christine

    Hi redsentence,

    I believe that the W3C validator is there purely as a guide and that certain allowances can be made with errors like the one mentioned.

    However, if you are desperate to get rid of this error you can do so by adding a custom function to your themes “functions.php” file.

    To do this, firstly open up your current theme’s “functions.php” file. At the end of the file add this code:

    add_filter( 'the_category', 'replace_cat_tag' );
    
    function replace_cat_tag ( $text ) {
    $text = str_replace('rel="category tag"', "", $text); return $text;
    }

    Finally, save the changes made to the file.

    The provided code should remove rel=”category tag” and therefore your code should pass validation.

    Thread Starter redsentence

    (@redsentence)

    Hi, thanks for the replies. Yes it was from W3C validator, unfortunately its how my clients like to check for validation so I need to adhere as much as possible. Thanks siobhyb I will give it a try!

    Jason

    No problem. Let me know how you get on with it. 🙂

    Thread Starter redsentence

    (@redsentence)

    Only just got round to this, works a charm! Thank you

    Glad it worked!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Invalid Markup’ is closed to new replies.