WordPress.org

Ready to get started?Download WordPress

Forums

The Bootstrap
[resolved] Invalid Markup (8 posts)

  1. redsentence
    Member
    Posted 1 year ago #

    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

  2. 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.

  3. pauluZ
    Member
    Posted 1 year ago #

    I agree with Christine

  4. 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.

  5. redsentence
    Member
    Posted 1 year ago #

    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

  6. No problem. Let me know how you get on with it. :)

  7. redsentence
    Member
    Posted 1 year ago #

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

  8. Glad it worked!

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags

No tags yet.