[wp-trac] [WordPress Trac] #29325: Use <time datetime> tag in Post Date

WordPress Trac noreply at wordpress.org
Wed Aug 28 02:36:11 UTC 2019


#29325: Use <time datetime> tag in Post Date
-------------------------+-----------------------------
 Reporter:  Apiweb       |       Owner:  SergeyBiryukov
     Type:  enhancement  |      Status:  reviewing
 Priority:  normal       |   Milestone:  5.3
Component:  Date/Time    |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
-------------------------+-----------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:7 Rarst]:
 > Added a small `the_time_tag()` function, defaulting to post published
 time but accepting arbitrary time stamp.

 Thanks for the patch! If `the_time_tag()` is intended for posts, it seems
 weird that it doesn't accept a `$post` parameter, like `get_the_date()`,
 `get_the_time()`, etc.
 {{{
 function the_time_tag( $format = '', $timestamp = null ) {
 function get_the_date( $d = '', $post = null ) {
 function get_the_modified_date( $d = '', $post = null ) {
 function get_the_time( $d = '', $post = null ) {
 function get_the_modified_time( $d = '', $post = null ) {
 function get_post_time( $d = 'U', $gmt = false, $post = null, $translate =
 false ) {
 function get_post_modified_time( $d = 'U', $gmt = false, $post = null,
 $translate = false ) {
 }}}

 Would it make more sense to pass `$post` as a second parameter, instead of
 `$timestamp`, for consistency with the other functions?

 If it's intended as a general purpose function, then I think it should be
 just that, and something like `the_post_time_tag()` could wrap it to
 display a post time.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/29325#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list