Site logo

[Resolved] How to show Last Updated wording and new date when updating a blog post

Home Forums Support [Resolved] How to show Last Updated wording and new date when updating a blog post

Home Forums Support How to show Last Updated wording and new date when updating a blog post

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #2582065
    Adrian

    Hi,

    How can I make a change to GeneratePress that enables the wording ‘Last Updated’ followed by the new date on my blog posts please? At the moment my blog posts only show the original post submission date. I would like users to known that my content gets updated.

    Thanks.

    #2582480
    David
    Staff
    Customer Support

    Hi there,

    quick question do you want to only show the one date ? ie. the most recent date.

    #2582592
    Adrian

    Hi David,

    Yes, I think just showing the ‘Last Updated’ (i.e. most recent) date is all I need.

    #2582910
    David
    Staff
    Customer Support

    Ok:

    1. Add this PHP Snippet to your site:

    https://docs.generatepress.com/article/generate_post_date_show_updated_only/

    This will make it so the latest date is always displayed.

    2. Add this CSS to add the Last Updated label:

    .entry-meta time:before {
        content: 'Last updated: ';
    }
    #2582989
    Adrian

    Thanks David.

    Just to confirm, I need to add the following to the additional CSS section in Customize:

    add_filter( ‘generate_post_date_show_updated_only’, ‘__return_true’ );

    .entry-meta time:before {
    content: ‘Last updated: ‘;
    }

    #2583073
    Ying
    Staff
    Customer Support

    No, Adrian, it’s PHP code, not CSS code.

    Use one of the methods introduced in the below article:
    https://docs.generatepress.com/article/adding-php/

    #2583074
    Adrian

    Already sorted. Apologies, my brain was on a go slow. Not tested yet but should be ok. Will confirm shortly.

    #2583077
    Adrian

    Ok, just tested and after amending a post I find that the post just shows the words Last Updated, followed by the original post date instead of the new date following a change to the post. How do I get around that please?

    #2583095
    Ying
    Staff
    Customer Support

    1. Make sure cache is cleared.

    2. Remove this PHP for now so that I can check if the updated date is logged:
    add_filter( 'generate_post_date_show_updated_only', '__return_true' );

    3. Link us to the post.

    #2583098
    Adrian

    Ok, snippet disabled.

    Here is a link to the post in question: https://thevoiceoftech.com/how-to-afford-a-gaming-pc/

    #2583103
    Ying
    Staff
    Customer Support

    Thanks!

    I can see both dates in the HTML.

    Now can you turn on the PHP code?

    Let me know!

    #2583113
    Adrian

    no change Ying

    #2583126
    Ying
    Staff
    Customer Support

    The PHP code doesn’t seem to be working, I can still see two dates.

    How did you add the PHP code?

    And can you temporality disable your cache plugin?

    #2583131
    Adrian

    I used WPCode Code Snippets plugin. Cache plugin also disabled.

    #2583303
    Fernando
    Customer Support

    Hi Adrian,

    Can you provide admin login credentials? We’ll take a closer look to see why it isn’t working.

    Please use the Private Information field for this: https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information

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