Back to Community

How to Display and Customize Post Dates in GeneratePress

37 threads Sep 16, 2025 ThemeGeneratepress

Content

One of the most common questions from GeneratePress users is how to manage post dates on their website. Many site owners want to display both the original publication date and the last modified date, or even replace the published date entirely with the updated date. This is crucial for content that is regularly revised, as it shows visitors the information is current.

Why This Happens
By default, WordPress and the GeneratePress theme display the publication date. The theme's structure includes the HTML for a modified date, but it is often hidden by default with CSS, which can lead to a brief flash of both dates (a layout shift) when using certain caching or critical CSS plugins.

Common Solutions

1. Displaying the Last Updated Date with CSS

If your theme is already outputting the modified date but it's hidden, you can use custom CSS to display it. Add the following code to your Customizer's Additional CSS panel:

.posted-on .updated {
    display: inline-block !important;
}
.posted-on .updated:before {
    content: "Last Updated on ";
}
.posted-on .entry-date:before {
     content: "Published on ";
}

2. Using a Custom Function (Advanced)

For more control, you can use a code snippet in your child theme's functions.php file. This approach modifies the HTML output for the dates. Note: Always use a child theme to avoid losing changes after theme updates.

add_filter( 'generate_post_date_output', function( $output, $time_string ) {
    $time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>';
    if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
        $time_string = '<time class="entry-date updated-date" datetime="%3$s" itemprop="dateModified">%4$s</time>' . $time_string;
    }
    $output = 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 $output;
}, 10, 2 );

3. Hiding the Modified Date to Prevent Layout Shift (CLS)

If you are experiencing a Cumulative Layout Shift (CLS) because a caching plugin briefly shows both dates, you can permanently hide the modified date with this CSS:

time.updated {
    display: none !important;
}

Important Considerations

  • Premium Features: Some advanced date customization options, like changing the text "Updated on" or using the Elements module for specific layouts, are part of the GeneratePress Premium plugin. According to WordPress.org forum rules, support for premium features cannot be provided in the free forums. For help with these, you would need to contact the GeneratePress team through their official premium support forum.
  • Custom Fields: For displaying specialized dates like a "medically reviewed on" date, you will need to create a custom field using a plugin like Advanced Custom Fields (ACF) and then write custom code to display that data in your template.

By understanding these methods, you can effectively control how dates are displayed on your GeneratePress site, ensuring a better experience for your readers and improved Core Web Vitals scores.

Related Support Threads Support