How to show last updated date on GeneratePress

How to show the last updated date on GeneratePress: Even if you update your material often, you’ve probably been bothered by your website’s published date.

This article explains how to show the latest modified date on GeneratePress posts.

GeneratePress displays the first post date by default. This tutorial explains how to display the latest updated date on blog entries.

Why show the last updated date?

How to show last updated date on GeneratePress

Readers love fresh content

Your viewers prefer updated, new material than outdated. If you don’t provide the latest updated date, readers may leave. You may wish to indicate a changed date as a blogger or brand.

Full and Satisfying Outcomes

If the latest updated date is included, it will be shown alongside the initial published date when someone does a search using Google or another search engine.

This increases the likelihood that people will engage with the newer post rather than the older one. As such, you now have one additional justification for including the latest updated date feature into your GeneratePress theme.

Read Also: How to add inline related post in WordPress?

How to add the last updated date on the GeneratePress theme

  • The GeneratePress theme’s support for a “last updated” indicator requires a separate plugin, WPCode, which must be installed first (Previously Insert headers and Footers)
  • To access plugins, go to Plugins >> Type “WPCode” into the Add New box and hit enter.
  • To install and activate the WPCode plugin, click the corresponding button.
  • To access these snippets, go to the left side of the dashboard and choose Code Snippets >>. A Snippet to Add >> Type in your own special instructions.
  • Please include the title in the excerpt. Nothing is off limits. We provide the “Last updated date” for your convenience.
  • Choose PHP as the “Code Type”
  • Just insert the PHP code below and hit “Save” to finish. With this update, your GeneratePress theme will now display the date it was last modified.
add_filter( 'generate_post_date_output', function( $output, $time_string ) {
    $time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">Published on: %2$s</time>';

    if ( get_the_date() !== get_the_modified_date() ) {
        $time_string = '<time class="entry-date updated-date" datetime="%3$s" itemprop="dateModified">Last Updated on: %4$s</time>';

    $time_string = sprintf( $time_string,
        esc_attr( get_the_date( 'c' ) ),
        esc_html( get_the_date() ),
        esc_attr( get_the_modified_date( 'c' ) ),
        esc_html( get_the_modified_date() )

    return sprintf( '<span class="posted-on">%s</span> ',
}, 10, 2 );

The preceding code checks to see whether any of your blog articles have been edited after they were first published and displays the Last Updated date as “Last updated on:”; otherwise, it displays the “Published on:” date.

After you’ve added the most recent updated code snippet to your GeneratePress WordPress site, you may compare the post’s appearance before and after the change.

Read Also: how can I include breadcrumbs in the GeneratePress theme ?

Finally, I’ll Say

In this guide, we will show you how to easily add the latest updated date to the GeneratePress theme by using the WPCode plugin.

Feel free to leave a question or remark below.

Saurabh Vishwakarama is Founder & CEO of & Publisher with an Entrepreneur. He is Also a Student & Full Time Passionate Blogger.

Leave a Comment