Site logo

Archived topic

How to show hour, minutes & seconds in published time?

16 replies · Started by Ravi Dixit on September 15, 2022

Viewing posts 1–15 of 17

Hello, Team!

I want to know how can I show published time as hours, minutes, or seconds ago when the published time is less than 1 day. It should only work for posts which have a published time of fewer than 24 hours. else other posts should show the normal dates.

Please check this example https://prnt.sc/q_JTdGBLoAvy

Also, I want this for the modified date. I have my single post header created using the Elements in GeneratePress. Used the post date as the Updated date. Please let me know how can I make the above changes.

This plugin will change for all the posts, but I want the changes for only posts published or updated less than 24 hours ago. All other posts should show the same format date.

It looks like there's an option in the plugin to apply to posts published in a specific time frame.

Maybe try to contact plugin support?

Yes, I just installed the plugin and found the option as well. But after activating the plugin, my post updated time is not showing after the post title. It is completely hidden.

I selected 1 day in "Apply to posts not older than" so the latest posts published or updated less than 24 hours ago not showing the date and older posts are showing the date correctly.

Can you link us to a recently published post where I can see the issue?

I have shared the link in the Private information field. Also you can visit the old posts on the same site to see they are showing the date.

Hum, I just tested on my end, and it doesn't seem to have this issue.

Can you provide admin login so we can take a look at the backend?

Sure, I have shared the access through the private field.

It's because you are using the updated date as the date, but the recent post doesn't have an updated date, it only has the published date.

Try change the date settings in the single post hero block element, like this:
https://www.screencast.com/t/MxRCpsB77

I made the changes aw you suggested but still not working.

Pages are not showing the time as I wanted, they are showing the date.

Also, some posts are showing hours ago time on the homepage if you scroll down to Cricket News Category, but when I open them, they show the date.

Also, I tried updating a post to check but it did not work.

Have you cleared the cache?

Yes, I did!

Ah, the date has to be inside the loop, otherwise, the plugin would not detect the date.

You'll have to change the hook from after header to before content.

I am not able to find the hook, can you share where I can find it?

This archived topic is closed to new replies.