aken from twenty-seventeen, this echoes a time element with the publish date of the post. It might also return the update date of the post.
File: inc/template-tags.php
function ign_posted_on() {
// post published and modified dates
echo '<div class="posted-on">' . ign_time_link() . '</div>';
}
This function does rely on the ign_time_link()
function:
function ign_time_link() {
$time_string = '<time class="published" datetime="%1$s">%2$s</time>';
//if when post was made does not equal the modified date
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '<time class="published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
}
$time_string = sprintf( $time_string,
get_the_date( DATE_W3C ),
get_the_date(),
get_the_modified_date( DATE_W3C ),
get_the_modified_date()
);
// Wrap the time string in a link, and preface it with 'Posted on'.
return sprintf(
/* translators: %s: post date */
__( '<span class="screen-reader-text">Posted on</span> %s', 'ben-landel' ),
'<a class="entry-date" href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
);
}