- This topic has 7 replies, 3 voices, and was last updated 5 years, 4 months ago by
Elvin.
-
AuthorPosts
-
November 27, 2020 at 8:50 am #1552826
Ayoosh
Hi Team,
I am trying to work on a feature, where I like to show the modified time on the post if available and fallback to the published date (if modified date not available)
I followed the instruction available on the following page
https://docs.generatepress.com/article/show-the-updated-post-date/However on adding the given css, even the published date were not visible on my posts. Also please that I am using the “Display post date” feature under the Blog customization option in GP.
Let me know if I am missing something or doing in incorrectly?
November 27, 2020 at 10:39 am #1553102Leo
StaffCustomer SupportHi there,
Any chance you can link us to the site in question?
You can use the private information field.
Let me know 🙂
November 29, 2020 at 9:22 am #1556795Ayoosh
I have provided the required details. Please check the following URL on the frontend
https://staging.javadevjournal.com/spring-security/spring-security-session/
If you check the details, you will find that this article was updated today, however no date is visible on the front end
FYI : I am using simpelCSS plugin to add custom CSS for my site.
November 29, 2020 at 1:02 pm #1557156Elvin
StaffCustomer SupportHi,
To show the modified date only, use
generate_post_date_show_updated_only.
https://docs.generatepress.com/article/generate_post_date_show_updated_only/Example:
add_filter('generate_post_date_show_updated_only', '__return_true');To add modified date AND time, you’ll have to filter the date display through
generate_post_date_output.
https://docs.generatepress.com/article/generate_post_date_output/December 27, 2020 at 5:21 pm #1596113Ayoosh
Hi Elvin,
Thanks for your response and sorry for the late response, my question was to show modified date if available else it should fall back to the publish date.
Not sure if this is possible?
December 27, 2020 at 5:33 pm #1596121Elvin
StaffCustomer SupportAh right,
In that case, what you’ll need is a PHP snippet in this reply:
https://generatepress.com/forums/topic/showing-last-updated-and-posted-date-date-format/#post-1572165December 27, 2020 at 5:35 pm #1596122Ayoosh
Never-mind, I got the clue form other post and able to make it work.
December 27, 2020 at 5:37 pm #1596123Elvin
StaffCustomer SupportNice one. Glad you got it sorted.
-
AuthorPosts
- You must be logged in to reply to this topic.