Hi.
i’ve seen a lot of discussion on this and tried similar to the discussion under “https://generatepress.com/forums/topic/displaying-last-updated-date-time-on-posts/”
I used the code in my functions.php
function wpb_last_updated_date( $content ) {
$u_time = get_the_time(‘U’);
$u_modified_time = get_the_modified_time(‘U’);
if ($u_modified_time >= $u_time + 86400) {
$updated_date = get_the_modified_time(‘F jS, Y’);
$updated_time = get_the_modified_time(‘h:i a’);
$custom_content .= ‘<p class=”last-updated”>Last updated on ‘. $updated_date . ‘ at ‘. $updated_time .'</p>’;
}
$custom_content .= $content;
return $custom_content;
}
add_filter( ‘the_content’, ‘wpb_last_updated_date’ );
added this css
.last-updated {
font-size: small;
text-transform: uppercase;
background-color: #efefef;
}
It does work, but i didn’t want to modify any of the pages.
Somehow i missed the part on how to control where this shows. I only wanted it on the posts. I want no date on my pages as they are static.
I’m sure you’ve answered this I’m just not locating the correct sequence of information.
Thanks. Martha
GeneratePress 2.0.1
GP Premium 1.5.6