How to display Last Modified date in Hestia

If you're running a news blog or where the content is constantly being updated then you might want to display the last modified date in your blog posts instead of the date of article being published.

You can easily do it using a child theme. If you aren't using a child theme already, here is how to make a child theme.

After downloading your child theme from the link above, it's time to edit it a little bit. Please go to the functions.php file of your child theme, and add the following code at the end:

function hestia_show_updated_date_on_single() {

    global $post;
    $author_id        = $post->post_author;
    $author_name      = get_the_author_meta( 'display_name', $author_id );
    $author_posts_url = get_author_posts_url( get_the_author_meta( 'ID', $author_id ) );

    $output =
        sprintf(
        /* translators: %1$s is Author name wrapped, %2$s is Date*/
            esc_html__( 'Last updated by %1$s on %2$s', 'hestia-pro' ),
            /* translators: %1$s is Author name, %2$s is Author link*/
            sprintf(
                '<a href="%2$s" class="vcard author"><strong class="fn">%1$s</strong></a>',
                esc_html( $author_name ),
                esc_url( $author_posts_url )
            ),
            get_the_modified_time( get_option( 'date_format' ) )
        );

    return $output;
}

add_filter( 'hestia_single_post_meta', 'hestia_show_updated_date_on_single' );

This will update the date of the post every time a change has been made.

Save the file, and it should do it.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us