Support » Theme: Olsen Light » I need to replace ‘Created date’ with ‘last updated date’

  • ravikirans

    (@ravikirans)


    Hello team,

    Right now, if I update my blog posts, the date doesn’t change as it is displaying the created date.

    I do not want ‘created date,’ but rather ‘Last updated date’ to be displayed.

    If possible I need to show the text ‘Last Updated Date,’ although I am not sure how this would fit in

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Fotis

    (@markwaregr)

    Hi there,
    by default the theme displays the created date always, I suggest checking this article https://www.wpbeginner.com/wp-tutorials/display-the-last-updated-date-of-your-posts-in-wordpress/
    on adding Last Updated date also. While you can open single.php,content-entry.php and content-entry-widget.php and remove

    					<time class="entry-date" itemprop="datePublished" datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>"><?php echo esc_html( get_the_date() ); ?></time>
    

    replacing it with

    
    <?php 
    $u_time = get_the_time('U'); 
    $u_modified_time = get_the_modified_time('U'); 
    if ($u_modified_time >= $u_time + 86400) { 
    $updated_date = get_the_modified_time('F jS, Y');
    $updated_time = get_the_modified_time('h:i a'); 
    $custom_content .= '<time class="entry-date"> '. $updated_date . ' / '. $updated_time .'</time>';  
    }
    echo $custom_content;
     ?>
    
    

    But it is not suggested to hide the original date.

    Let me know if you need additional help with this.

    Hello Fotis,

    Thank you for the solution. Can you please let me know why it is not suggested to remove created date of the blog post and replace it with the updated date?

    And, if I have to show them both, I am not sure how they would appear in the UI

    • This reply was modified 1 month, 3 weeks ago by ravikirans.
    Fotis

    (@markwaregr)

    Hi there,
    purely for SEO reasons. One should stay as it is while the other you appear before the content, like the suggested article.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.