This PHP code enables you to display text in replace of the comment date if the comment is older than a specific date. In this example, all comments older than 1 year will display the text “Older Than 1 Year”. All comments less than 1 year old will display the comment date.
Here’s a video demo:
There’s 2 code snippets included in this tutorial.
1. The 1st code snippet removes the time and only displays the comment date or the custom text.
When comment is older than 1 year:
2. The 2nd code snippet doesn’t remove the time so it displays the comment date for comments less than a year old and the text “Older Than 1 Year” inline with the time like you see in the following image:
Here’s the code snippets for logged in members:
Leave a Reply
You must be logged in to post a comment.