Site logo

[Resolved] Insert ‘Last Updated On’ date for all blog articles

Home Forums Support [Resolved] Insert ‘Last Updated On’ date for all blog articles

Home Forums Support Insert ‘Last Updated On’ date for all blog articles

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2424956
    rajjj

    Hi Team,

    How do I have the date of post published with ‘Last updated on (updated date)’ right under the blog title?
    I have used the code add_filter( ‘generate_post_date_show_updated_only’, ‘__return_true’ );

    But it just changes the published date. How can I have it show the date as ‘Last updated on with the date’

    #2424971
    Fernando
    Customer Support

    Hi Rajj,

    To clarify, do you want to show just the updated date or the published date(if there’s no updated date). Or, do you want to show both if the updated date is available?

    #2425095
    rajjj

    Just need the date to be displayed as ‘Last updated on date’.
    It there is no update, the date will be the date when it was published.

    #2425208
    David
    Staff
    Customer Support

    Hi there,

    add this PHP Snippet to your site:

    add_filter( 'generate_post_date_output','tu_add_to_post_date' );
    function tu_add_to_post_date( $output ) {
        return '<span class="date-label">Last updated on </span>' . $output;
    }

    How to add PHP:
    https://docs.generatepress.com/article/adding-php/

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