Premium support

Please log in to post in these forums. If you didn't create an account when you purchased, please contact us.

Free support

If you haven't purchased GP Premium, support for the free theme can be found on

[Support request] Post Updated Date

Home Forums Support Post Updated Date

This topic contains 5 replies, has 2 voices, and was last updated by  Tom 4 days, 21 hours ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #470419


    I need to show last updated date instead of published date. I did the following but there is some problem.

    .posted-on .updated {
        display: inline-block;
    .posted-on .updated:before {
        content: "Last updated: ";
    time.entry-date.published {
        display: none;

    Above shows updated for the post which was updated but blank which was not updated since published.

    So I am looking for fixes which do the following.

    Show Last updated when post was modified
    Show original published date if post is not updated

    This should also reflect in the source code. Currently, it shows published_time and modified_time both.

    GeneratePress 2.0.1
    GP Premium 1.5.6

    Lead Developer

    If you want to only show the modified date in the source if it’s set, you can scrap that CSS and use this PHP:

    add_filter( 'generate_post_date_output', 'tu_show_modified_date' );
    function tu_show_modified_date() {
    	$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="updated" datetime="%3$s" itemprop="dateModified">%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() )
    		'<span class="posted-on">%1$s</span>', // WPCS: XSS ok, sanitization ok.
    		sprintf( '<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>',
    			esc_url( get_permalink() ),
    			esc_attr( get_the_time() ),

    Let me know 🙂


    Hello Tom,

    It’s not working as expected.

    I removed those CSS and added what you mentioned in functions.php file of the child theme.

    I still don’t see last updated time on the blog post. Ex – this still shows June but post was updated in November.

    Source code still has both times.

    <meta property=”article:published_time” content=”2017-06-15T22:04:32+08:00″ />
    <meta property=”article:modified_time” content=”2017-11-12T14:40:47+08:00″ />

    Please help. As mentioned earlier, I want to show only last updated time on a blog post and source code. However, if post is not updated then show the original published time.


    Lead Developer

    I just adjusted the code a bit to test if it’s working at all – can you update it and let me know?


    It has no affect at all. Still, the same as you can see here –


    Lead Developer

    I think I see the issue – I just adjusted the code above.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.