This small code snippet will help you to display the time ago for WordPress post if your post was published less than 24 hours ago.