Home › Forums › Pro Support › Showing time as well as date? › Reply To: Showing time as well as date?
January 22, 2019 at 4:43 pm
#7328
Keymaster
Give this a shot:
add_filter( 'wpsp_date_output', function( $output ) {
$time_string = '<time class="wp-show-posts-entry-date published" datetime="%1$s" itemprop="datePublished">%2$s, %5$s</time>';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string .= '<time class="wp-show-posts-updated" datetime="%3$s" itemprop="dateModified">%4$s, %5$s</time>';
}
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() ),
get_the_date( 'g:i a' )
);
return sprintf(
'<span class="wp-show-posts-posted-on wp-show-posts-meta">
<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>
</span>',
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
$time_string
);
} );
Let me know 🙂