Question from Keisha P.: I write a fairly popular WordPress blog and I occasionally change the dates on some of my older posts to put them back onto the first page of the blog.
But that’s causing a problem because the comments on those posts still have the old dates/times on them. I’m afraid my readers will notice the old dates and realize that the posts aren’t really new.
I’m using the Genesis framework and Executive Pro child theme on this blog. I know I can remove the code that displays the comments’ date and time from the Genesis module but I’m hoping there’s a better way. Do you know of one?
Rick’s answer: There is indeed a better way, Keisha. As you probably know, any changes you make to the Genesis framework itself will be reversed the next time you install an update to the theme.
Luckily, there’s an easy way to remove the date and time from your blog’s comments just by adding a single line to one of your child theme’s files, and the change won’t be overwritten by a theme update.
But before I explain how to do that, I ask that you read my semi-standard disclaimer:
Making changes to any of the files that make up your WordPress installation can cause serious issues with your blog if even a minor error is made. In fact, a single misplaced character could prevent your blog from loading at all.
That’s why I always strongly recommend making a backup copy of every file you plan to alter before you make any changes.
Alternatively, you can always simply use a plugin to remove the meta information from your blog’s comments. You’ll find several such plugins to choose from in the official WordPress Plugins Repository.
After reading, understanding and agreeing to the above disclaimer, you can proceed (at your own risk) by following the steps below:
1 – Open the functions.php file that’s located in the directory containing your blog’s child theme.
2 – Save a backup copy of the unchanged functions.php file so you’ll be able to quickly reverse any changes should something go wrong.
3 – Add the following line to the very end of the original file:
add_filter( ‘genesis_show_comment_date’, ‘__return_false’ );
4 – Save the altered file and upload it to your server.
That’s all there is to it. If you refresh the page for one of your blog posts that has comments on it you should no longer see the date and time stamps on the comments.
Just in case there’s someone reading this who isn’t using the Genesis framework (you really should be in my opinion), there’s an easy way to do the same thing on blogs using non-Genesis themes. Here’s how:
1 – Open the style.css file that’s located in the directory containing your blog’s theme.
2 – Save a backup copy of the unchanged style.css file so you’ll be able to quickly reverse any changes should something go wrong.
3 – Add the following lines to body of the original file:
.comment-metadata {
display: none;
}
4 – Save the altered file and upload it to your server.
As with the Genesis solution mentioned earlier, if you refresh the page for one of your blog posts that has comments on it you should no longer see the date and time stamps on the comments.
Update from Keisha: I followed your instructions and it worked perfectly. Thanks Rick.
Bonus tip #1: Want to know how Keisha changes the order of her blog posts? You’ll find instructions right here.
Bonus tip #2: Want to make sure you never miss one of my tips? Click here to join my Rick’s Tech Tips Facebook Group!
Would you like to ask Rick a tech question? If so, click here and send it in!
If you found this post useful, would you mind helping me out by sharing it? Just click one of the handy social media sharing buttons below. Thanks a bunch!