Modified date instead of date posted?

Posted in: Newspaper
Post count: 230

Not using Composer or any of the drag and drop stuff – how can I change the date on the posts, and on the homepage, to the date it was last updated?

Site is here: https://www.thenerdystudent.com/

I would like to change the date below the title on the homepage to the updated date, and below the title on individual posts. I used to be able to do this via php on older versions but cannot get it working now.

Thanks

Post count: 230

Got it working:

else {
if (td_util::get_option('tds_p_show_date') != 'hide') {

global $wp_version;
//old WP support
if (version_compare($wp_version, '5.3', '<')) {
$td_article_date = date(DATE_W3C, get_the_modified_time('U', $this->post->ID));
} else {
// get_post_datetime() used from WP 5.3
$td_article_date = get_post_datetime($this->post->ID, 'date', 'gmt');
if ( $td_article_date !== false ) {
$td_article_date = $td_article_date->format(DATE_W3C);
}
}

$buffy .= '<span class="td-post-date" style="color:#aaa;">';
$buffy .= 'Last Updated: <time class="entry-date updated td-module-date' . $visibility_class . '" datetime="' . date(DATE_W3C, $td_article_date_unix) . '" >' . get_the_modified_time(get_option('date_format'), $this->post->ID) . '</time>';
$buffy .= '</span>';

}
}

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.