I am using startup blog theme. Instead of Published on date I would like to use Last Updated date for posts. After some searches I came to know that I need to replace function get_the_date() or the_date() with the_modified_date(). But in code I am not able to understand the $date variable is defined and how to add above function.
<?php
$author_display = get_theme_mod( 'post_byline_author' );
$date_display = get_theme_mod( 'post_byline_date' );
if ( $author_display == 'no' && $date_display == 'no' ) {
return;
}
$author = get_the_author();
// add compatibility when used in header before loop
if ( empty( $author ) ) {
global $post;
$author = get_the_author_meta( 'display_name', $post->post_author );
}
$date = date_i18n( get_option( 'date_format' ), strtotime( get_the_date(
'r' ) ) );
echo '<div class="post-byline">';
if ( $author_display == 'no' ) {
// translators: %s = the date the post was published
printf( esc_html_x( 'Published %s', 'This blog post was published on some
date', 'startup-blog' ), esc_html( $date ) );
} elseif ( $date_display == 'no' ) {
// translators: %s = the author who published the post
printf( esc_html_x( 'Published by %s', 'This blog post was published by some
author', 'startup-blog' ), esc_html( $author ) );
} else {
// translators: %1$s = the date the post was published. %2$s = the author
who published it
printf( esc_html_x( 'Published %1$s by %2$s', 'This blog post was published
on some date by some author', 'startup-blog' ), esc_html( $date ), esc_html(
$author ) );
}
echo '</div>';
If you want to keep the same format as retrieved by the previous date function, replace:
with
get_the_modified_date()
: