If you’ve ever wanted to create an “evergreen” WordPress blog by removing post dates, here’s how to do it.
Hi, this is Laura Roeder and today I’m going to show you how to remove the post dates from your WordPress blog so that your blog posts can stay more evergreen, so that someone doesn’t look at your blog and see that it’s a year old. If you remove the dates they don’t know when you wrote it and it helps blogs seem more timeless.
So, this is going to get much more technical than the information that I usually share. The only way to remove the date is to go into the code and to read a little bit of code. So we are going to be code monkeys today, more technical than I usually get but I’m designing this for people who do not know PHP. So, if you don’t know PHP, if you don’t know HTML, don’t worry, I think you can follow along and do this, I’m going to show you exactly what to look for. So, let’s get started.
The first thing you want to do is sign into your WordPress website. I’ve just created a test site for the purpose of this presentation and you can see that right now there is the date. There is the headline and then right below it is March 29th, 2009. So we want to take that date off, that’s our goal, it’s what we’re doing right now. So, how you’re going to do this is to go to the editor under appearance. So on the left hand side you’ll see appearance and then you’ll see editor and we’re going to need to look for the piece of code that references this date in all of our WordPress template files and we’re going to remove it. So basically this date is created by a piece of code that tells WordPress to recall the date that the post was created so if we take out that piece of code this date will longer show up.
So, I’m going to start with the main and next template because I know it’s there but as you’ll see in a minute I’m going to ask you to go through all the templates because the date can show up in a lot of places. It’s going to show up on archives, it’s going to show up on the regular post page. Without being familiar with the code you don’t really know where it’s going to show up so the safest bet is to search for everything. So again under appearance I went to editor and you can just start with any of these pages. I’m starting with the main index template for the purpose of this presentation because I know it’s in there and then I want you to do a find. You can do this using your browser, just Ctrl F or or apple F will find something in the content. What we’re going to look for is the phrase, the_time. You can see it right here, the_time. That’s a little code snippet that tells you that WordPress is looking for the date.
Once I’ve found the time, it’s highlighted right here and this is the entire bit of code. I’m going to isolate it so that it’s a little easier to read. Just so you know, in code you can move – space stuff out as much as you want. If I put all these spaces before and after it does not affect the code so don’t worry about putting spaces before and after something in order to make it easier to see. So, remember we did a search for the time. Here’s the time right here and then there is other kind of gobbledygook that surrounds the time. This is the PHP WordPress code so what we want to do is isolate just the time. The way you can do that is to look for these little brackets right here, this little less than, greater than signs. That shows you the beginning and end of a piece of code.
So, when you look for the time it’s going to look a different depending on how they have it set up. It might not have this ‘fjsy’ exactly as this one is because there is a few different ways you can do it which is why I’m having you look for the time, that’s universal and to find the whole piece of code you’re going to look for these little carrots outlining it. This one in the beginning and this one in the end that’s how you know you have one solid piece of code because you don’t want to break in the middle of the code or else this won’t work. Basically you can think of it as you need to take out this entire piece not just part of it. So once you’ve found that, one thing you can do is just delete but I’m going to show you a better way.
So, instead of deleting it we’re going to do what’s called commenting it out. So comments are a way to add a line of code that you want for your own reference but that won’t affect what actually happens on a web site. People use comments for notes to other developers and stuff like that but it’s also a way to have your web site not read a piece of code without having to delete entirely. So it’s a good idea to use comments to kill a piece of code so that you’re not deleting it so you can still get it back if you need it. So again the first step is to search for the time, then you want to isolate it by looking for these little characters on the beginning and on the end and then we want to make it a comment. The code to do that is you put this little greater than sign, an exclamation point and then two dashes and then you close it by putting two dashes, and then another little carrot there.
So again the way I told you this marks the beginning and end, this marks the beginning and end of a comment as well. So, it starts with the – I think I said greater than sign but this is actually a less than sign isn’t it. Oh I have to remember my elementary school math. Let’s just say the arrow that’s pointing to the left. It starts with that, then you have an exclamation point and then two dashes, then inside of that you’re putting your little the time code snippet, and then you end it with another two dashes and a little arrow pointing to the right. So this is what the whole thing should look like and then you want to go ahead and update your file to save it.
So, I want to do another find for the time to make sure I got all the instances. Okay, there’s only one, and then I just want to click on all these template files on the right hand side and do that search. Okay, so it’s not in the comments file in this instance but you need to search every file in your theme because it’s different, every theme. Okay, it’s not in footer. Let’s look in the header. It’s not in the header. We already looked in the main index template, let’s look in the search forum, okay it’s not there. Let’s look in the side bar. Not there and let’s look in theme functions. Not there. Okay, so in this one we only had to look in one template. Again this totally depends on your theme. You might find it in more than one template but in our case it was only in the main index template.
I just want to give you another really brief refresher of what I did. I searched for the time. I isolated that little code snippet and then I commented it out using this code right here, I made it disappear. We’re going to check and see if what we did worked. So remember this is the old version. I’m going to refresh this page and see if March 29th, 2009 disappears and it does. All right, that means that it worked and we should be able to click on the individual posts and it should be gone from there as well. So that is how you remove the date from a post in WordPress. Again, the key thing that you want to do, you want to go under appearance, go to the editor, just do a find through each one of these files. You want to look for the_time. You want to isolate that little snippet of code and then you want to comment it out.
You want to make it a comment instead of an actually piece of code by doing this little carrot exclamation point two dashes, another two dashes and then the little carrot going the other way. You can also just go ahead and delete this code but it’s better to do this so that if you ever want to bring it back you still have it there. You hit update file and that’s all you have to do. Then you have your great web site without any kind of date on the post.
Again this is Laura Roeder. You can check out my web site at lkrsocialmedia.com.