Display Last Updated Date
Appends the post's last-modified date below the content on single posts.
PHPby SnipCraft
php
<?php
add_filter( 'the_content', 'scseed_append_last_updated_date' );
if ( ! function_exists( 'scseed_append_last_updated_date' ) ) {
function scseed_append_last_updated_date( $content ) {
if ( ! is_singular( 'post' ) || ! in_the_loop() || ! is_main_query() ) {
return $content;
}
$updated = get_the_modified_date( get_option( 'date_format' ) );
$label = '<p class="scseed-last-updated"><em>'
. esc_html__( 'Last updated: ', 'scseed' )
. esc_html( $updated )
. '</em></p>';
return $content . $label;
}
}#content#dates#display#posts#seo