WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] pubdate validation issue (10 posts)

  1. Pioneer Valley Web Design
    Member
    Posted 2 years ago #

    On Swanson Heritage (and 2 others also), I am having an HTML5 validation issue (http://validator.w3.org/)

    The generated code in question is:

    <time class="entry-date" pubdate="" datetime="2012-07-07T13:04:42+00:00">

    And the validation error is:

    Attribute pubdate not allowed on element time at this point

    As you can see 'pubdate' is blank anyway (should it be??).

    I have looked on here for this issue and found nothing of use...looked online and found a few links stating that this is actually an error by the validator...

    So, as I am trying to get these sites to validate, does anyone have a quick fix to apply to my twentyeleven child themes?

    I assume I can include a custom functions.php file, de-register some function, and add the modified one back in but I am not sure which one or if I may break something in doing so...

  2. Pioneer Valley Web Design
    Member
    Posted 2 years ago #

    Mod can feel free to change title to 'pubdate'

  3. Pioneer Valley Web Design
    Member
    Posted 2 years ago #

    OK - Bump to OTTO online now :-)

  4. Rachel Baker
    Member
    Posted 2 years ago #

    Actually the code that is generated by TwentyEleven is:

    <time class="entry-date" datetime="2012-07-04T23:02:20+00:00" pubdate>July 4, 2012</time>

    pubdate was removed from the W3C HTML5 spec, and it's future is in doubt.
    More on this: http://www.brucelawson.co.uk/2012/best-of-time/ and http://html5doctor.com/time-and-data-element/

    You can remove the pubdate text from the function in TwentyEleven, this is function you want to edit: http://pastebin.com/W4mGHfTg

  5. Pioneer Valley Web Design
    Member
    Posted 2 years ago #

    I assume I can include a custom functions.php file, de-register some function, and add the modified one back in but I am not sure which one or if I may break something in doing so...

  6. Rachel Baker
    Member
    Posted 2 years ago #

    You can include this snippet: http://pastebin.com/jQGi6CsJ in your child theme's functions.php and it will override the same function in the TwentyEleven parent theme. I added some comments around the function to help you understand why the snippet works.

    More on Child Themes and functions.php files: http://codex.wordpress.org/Child_Themes#Using_functions.php

  7. Pioneer Valley Web Design
    Member
    Posted 2 years ago #

    @Rachelbaker,

    Thank you for the snippet...worked great...one other vaildation issue still on posts related to this lengthy post and discussion re: rel="category tag"

    I tried to copy the function to my child theme's functions.php file and edit rel="category tag" to rel="tag" as applicable (and noted in the linked to post), but received an error message...do I need to create my own function or how does one override a function from core (and not a theme)?

    I did edit the core file wp-includes/category-template.php to test (on one site) and the homepage does now validate to HTML5 (again thanks for your snippet), but I would prefer not to edit core files....any thoughts?

  8. Pioneer Valley Web Design
    Member
    Posted 2 years ago #

    Last response now moved to new post - initial post resolved.

  9. Gazeta1277
    Member
    Posted 1 year ago #

    You can remove the pubdate text from the function in TwentyEleven, this is function you want to edit: http://pastebin.com/W4mGHfTg

    Would you, please, say a little bit more on how to edit - for novice users. Which lines from which file should we delete or modify. Or you reccommend to delete the whole text shown in your link?

    It is interesting that so many standard themes from basic cms can not pass w3c markup validation...

  10. roadRUNN3R
    Member
    Posted 1 year ago #

    http://pastebin.com/W4mGHfTg

    If you're editing your theme's functions.php, search for pubdate and delete it.

    http://pastebin.com/jQGi6CsJ

    If you're working in your child theme's functions.php, copy lines 9-19 from this snippet.

    Btw, you can use tools like http://www.diffnow.com/ to search for differences in code and as Rachel said above:

    More on Child Themes and functions.php files: http://codex.wordpress.org/Child_Themes#Using_functions.php

Topic Closed

This topic has been closed to new replies.

About this Topic