WordPress.org

Support

Support » How-To and Troubleshooting » How to display post age? (and how to use age in an if statement…)

How to display post age? (and how to use age in an if statement…)

  • Just wondering how one would go about showing the age of a post, ie, instead of displaying the date a post was submitted, show something along the lines of This post is 3 days old. It seems as though this should be pretty straightforward, but i kind for the life of me find it in the documentation or elsewhere.

    The second part of my question is how you could go about styling posts differently depending on their age, ie. something along the lines of if post was published today, format it in such and such a way, if it was posted in the last week, format a different way, etc etc.

    Thanks in advance, will,

  • The topic ‘How to display post age? (and how to use age in an if statement…)’ is closed to new replies.