sheabunge / footer-text

Allow users to change the theme footer text easily from the dashboard
http://wordpress.org/extend/plugins/footer-text
MIT License
1 stars 3 forks source link

[last_modified] not in <time> format #2

Open schasoli opened 9 years ago

schasoli commented 9 years ago

[last_modified] output is not html standard is: should: 2015-04-11 see https://html.spec.whatwg.org/multipage/infrastructure.html#valid-date-string

function shortcode_last_modified() { return the_modified_date( 'd/m/Y', '', false ); return the_modified_date( 'Y-m-d', '', '', false );

It would be also nice to have a shortcode to get the date using the WP date format as set in settings.

schasoli commented 9 years ago

well, to stay as compatible as possible i added a new shortcode and tested 'last_modified_prefs' => array( $this, 'shortcode_last_modified_prefs' ),

changed function shortcode_last_modified() { /* return the_modified_date( 'd/m/Y', '', false );/ return the_modified_date( 'Y-m-d', '', '', false ); } and added function shortcode_last_modified_prefs() { return the_modified_date('','','',false); }

works fine for me.

sheabunge commented 9 years ago

Perhaps a good middle ground would be to include the standard YYYY-MM-DD format inside the datetime attribute on the <time> element, and then use the preferences format to display the date on the page. Something like this:

<time datetime="2015-04-21">21 April 2014</time>
schasoli commented 9 years ago

w3c validator accepts it and pubdate is not used anymore. So I think yours is the best solution for a footer. I do it like this $date1 = the_modified_date( 'Y-m-d', '', '', false ); return the_modified_date('','<time datetime="'.$date1.'">','</time>',false);

looking at http://html5doctor.com/time-and-data-element/ maybe this would be nice for google and co: <article itemscope itemtype="http://schema.org/BlogPosting"> <data itemprop="datePublished" value="2015-04-21">21 April 2014</data></article> But it would need to more shortcodes: beginArticle, endArticel or so. edit: https://wordpress.org/plugins/itempropwp/ could be used for this

sheabunge commented 9 years ago

I've updated the code to use the first format. I'm not entirely sure about using the second method; it looks more suited to a local article footer such as the area where categories, tags, published date, etc are displayed, not a global footer area which could be virtually anywhere.