Archived topic
I want to show "Last Updated" instead of when post published
7 replies · Started by Usman on December 18, 2021
Hello there,
I want to show the last updated time under the post title instead of when it was published. For this, I researched a little bit and found https://docs.generatepress.com/article/show-the-updated-post-date/ this article.
I don't understand what to do with this CSS or other codes.
Is there anyone who assist me in updating May 17, 2021 by USM to by USM | Last Updated August 22, 2021?
Thanks in advance
Looking Forward
Usman
Hi Usman,
Go to customize > additional CSS, copy and paste this CSS to there:
.posted-on .updated {
display: inline-block;
}
.posted-on .updated + .entry-date {
display: none;
}
.posted-on .updated:before {
content: " | Last Updated ";
}
.single-post .entry-meta {
display: flex;
}
.single-post .entry-meta >span.byline {
order: -1;
padding-right: 10px;
}
Let me know if this helps :)
Yes, it worked perfectly on single posts. Thank you Ying.
I am looking if it works on archive pages too?
Currently, some posts in archive pages show "August 25, 2021 by USM" while others "| Last Updated November 2, 2021 by USM"
Thanks again.
Usman
Hi Usman,
Can you link us to a sample archive page of the site you're working on? To be sure why the CSS isn't working for it and have a better idea on which way to approach this.
You can use the private information text field to provide the link - https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information
Let us know. Thanks! :D
Hey Elvin, thanks for replying.
Here is the link: https://smartkitchens.review/grills/
Looking Forward
Usman
Ah I see now. thanks.
The posts that doesn't display Last Updated are posts that have no history of being modified. They don't have a modified date to display so there's no element to display "last updated" on.
Any specific parts you need fixed? (example: removing | on archive pages?)
We can modify this CSS to remove | on archive pages.
Example:
body:not(.blog,.archive) .posted-on .updated:before {
content: " | Last Updated ";
}
body.blog .posted-on .updated:before,
body.archive .posted-on .updated:before {
content: "Last Updated ";
}
Thanks, Ying and Elvin for a perfect solution.
You are welcome!
Always happy to help :)