I'm building a blog theme. I know that
date() functions display published date of posts. And I know how to get posts' published time with
I want today's posts to show published time and all other old posts to show published date. For example, today is September 8. All the posts that were published today should show published time (08:40, 16:30, etc). But the posts that were published yesterday or longer before should show only date (September 07, July 26, etc).
How can I achieve this goal?
I guess there's a way to compare post's published date with today's date and make decision whether to display time or date that way. But there must be more optimal and easier way.