Archived topic
Posted on/Last updated - on blog post without header element
10 replies · Started by CRAIG on July 8, 2021
i have read the article here https://docs.generatepress.com/article/show-the-updated-post-date/#show-the-%E2%80%9Cupdated%E2%80%9D-post-date-in-header-element
Is there a way to do this without a header element?
The reason I ask is that I have my post layout looking pretty much the way I want it, and I would like to avoid creating a header element.
Hi there,
can you share a link to a post so i can advise the best way to do it.
Hi David,
I have added a link to a post privately below
Are you wanting to display both dates with a label before them? eg.
Posted on: {date} / Last Updated: {date}
I would like it to say "Date published", but if it has been updated, I would like to display "Last Updated:" instead
Hi Craig,
Can you try adding this CSS?
.posted-on .updated:before {
content: "Last Updated: ";
}
.posted-on .published:before {
content: "Date published: ";
}
And then check the site. Let us know if the result is desirable or needs adjusting.
Hi Elvin,
I have added a link to a post privately
The published date is showing
I've then went in and edited some text and published, but there is no change, the published date is still showing with the original published date
I previously had this CSS on there:
.posted-on .updated {
display: inline-block;
}
.posted-on .updated + .entry-date {
display: none;
}
I removed this before adding the code you have specified
Create a new Block Element - and choose the Post Meta element type:
https://docs.generatepress.com/article/block-element-post-meta-template/
All you need is a headline block, set the dynamic text type to Post Date, and then check this screenshot:
https://www.screencast.com/t/YGWHgl1D
Make sure to set the Display Rules to Posts > All Posts.
Hi David,
Thanks for this
I have created a block and set the dynamic text as above, but I can't get it to display
When I change the typography settings i.e. line height, and publish and refresh the post page I can see that there is a change in spacing, so I know something is happening, but I just can't see the text
I have checked that the text colour and font size are set appropriately and location is set to Post : All Posts
I have it working now
I shouldn't have put the headline block inside a container
I thought it said to do this in the help video, but when I done it again with a container it worked
Glad to hear that!