• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2662

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Support
  • Newsletter
  • Videos
  • Log in

Premium Member? - Request custom code

Replace Comment Date With Text When Comments Older Than Specific Date

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.

Video Demonstration

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.

date

When comment is older than 1 year:

text

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:

text

Here’s the code snippets for logged in members:

Register for full access

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems