how to Display the Last Updated Date in GeneratePress

How to Display the Last Updated Date in GeneratePress?

When you search online, the solution of how to display the last updated date in GeneratePress, even how to customize post meta in GeneratePress theme, you’ll get lots of guides. But finding a straightforward way for this solution is a time-consuming thing. 

That’s why, In this blog post, I’ll share a step-by-step guide with solid codes for adding and customizing post meta in your GeneratePress powered WordPress site.

What you’ll learn from this post

  • How to add the function of the last updated/modified date of post.
  • How to customize GeneratePress post meta.
  • How to custom design GeneratePress post meta using CSS codes.
how to Display the Last Updated Date in GeneratePress
Example of GeneratePress last modified date

Why Do You Need to Display Last Updated Date?

By default, GeneratePress theme doesn’t have a function to add the last updated date, but you can customize its default meta section using the theme customizer option. 

GeneratePress allows you to enable or disable post publication date, author name, comment, and post category. But the thing is that you can’t add any text before the post-publication date or meta section and the function of the last modified date of posts.

Displaying publish date and last updated date in every post has positive benefits for a website. Due to adding this feature under/above every blog post title, visitors can see when a post has published/updated.

The last modified date of posts increases trustworthiness to the readers for accruing the right knowledge. Even you’ll get more returning customers/visitors to your site because everyone wants updated information to solve their problems.

However, the major benefits are

  • Increase trustworthiness
  • Enhance more returning visitors
  • A clear idea of updated information
  • Balance website bounce rate
  • Search engines get notified about the last update
  • It can boost SERP position of keywords

How Does It Work?

This function works in two ways. These are

  • When you publish a new post, it’ll show the current publish date in the meta section.
  • When you update an existing post, it’ll show the last modified date.

Now let’s get started with the step-by-step guide.

How to Display the Last Updated Date in GeneratePress?

You can apply this exact guide in both the GeneratePress premium and the free version. One thing is that you have to install GeneratePress child theme first to add its function PHP code snippet.

If you’re a beginner and don’t know how to add or change a theme or plugin in WordPress, you can follow my other guides.

Next step: you have to create a GeneratePress child theme. You can download GeneratePress child theme or can create your own customized child theme using a plugin or can use a third-party online child theme generator tool.

Create a child theme using any way and install and activate that in your WordPress site.

Now go WordPress Appearance> Theme Editors menu, then click on the function.php file. Then enter the below code snippet on your theme funcation.php file and click on the “Update files” button.

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 );

Note: You can replace the text ‘last updated on:” with your own text.

funcation php file

Now go to the WordPress default customizer, which is under the Appearance menu. Then click on the “Additional CSS” and add the below code.

.entry-meta {
font-size: 14px;
text-transform: uppercase;
margin-bottom: 0px;

Note: The above CSS code snippet isn’t mandatory, but you can use it for good looking meta section.

In Conclusion

I’ve talked before there are plenty of benefits you’ll get after adding the modified date in every blog post or page. I’ve used the same PHP and CSS code snippet in my blog here at WP Basic Pro. So you can use these code snippets undoubtedly on your site to get the benefits of this customized function.

Read other guides of GeneratePress theme

What’s your Reaction?


  • Palash Talukder

    Palash Talukdar is a digital marketer & the founder of WP Basic Pro. He has been building and managing WordPress websites for 5+ years. He loves to write about WordPress, SEO, marketing, productivity, and web performance.

    View all posts
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Saeed Khosravi's Official Site