How to get the Last Updated date rather than Published date of post
-
Hi,
I have figured out the code which I have to modify to get Last Updated instead of Published date for blog posts. But on trying many things I am not able to get the Last Modified date. Here is the code of my theme
$time_string = ‘<time class=”entry-date published” datetime=”%1$s”>%2$s</time>’;
if ( get_the_time( ‘U’ ) !== get_the_modified_time( ‘U’ ) ) {
$time_string .= ‘<time class=”updated” datetime=”%3$s”>%4$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() )
);$posted_on = sprintf(
_x( ‘Posted on %s’, ‘post date’, ‘magnet’ ),
‘‘ . $time_string . ‘‘
);Please, let me know what to modify in this code to get the last updated date of post.
Post page :Track WhatsApp calls
Thanks in advance!
- The topic ‘How to get the Last Updated date rather than Published date of post’ is closed to new replies.