Site logo

Archived topic

Updated date on posts AND pages

1 reply · Started by Jason on December 16, 2022

Viewing posts 1–2 of 2

Hi there,

I got lost in a lot of the threads on showing the "updated date" on posts and I didn't see any that reference doing it on pages. A few of them say things are getting easier in the future but don't reference where that is.

Could you show me how to show the updated date on Posts AND on pages? If possible, maybe just as a reusable block or something like that that we can add with things like the author to the pages and posts we want it on?

Thank you.

Edit: Also, if there is a way to show the published date if no update has been made yet (like for newer content), but then only updated date after that—that would be great.

Hi there,

you can use a Block Element, for example here is a Post Meta element type:

https://docs.generatepress.com/article/block-element-post-meta-template/

But for Posts and Pages you can follow these steps:

1. Make sure you have the GenerateBlocks Plugin installed.
2. In Appearance > Elements -> Add New --> Block Element.
3. Set the Hook to: after_entry_header
4. In the block editor add a GB Headline block, and keep it selcted
4.1 give it some static text eg. date
4.2 In the sidebar settings > Dynamic Data -> Enable Dynamic Data
4.3 set the
DATA SOURCE - > Current Post
CONTENT SOURCE -> Post date
DATE TYPE -> Published
Toggle: Replace with updated date
4.4 Use the GB settings to style the date.

This archived topic is closed to new replies.