Date Exclusion WordPress Plugin

by Daniel in 85 Comments — Updated Reading Time: 2 minutes

Background Image

Would your blog benefit from removing the dates of the posts? That is the question I asked on the post “Should We Remove the Timestamp?”. The feedback from the readers was divided. Some people believe that the timestamp is necessary, while others think that removing the date from posts could have advantages, like increasing the number comments and linkbacks for the older content .

It is probably a subjective matter. Removing the date will work for some blogs, and not for others. Regardless of that choice, a lot of people are not comfortable with editing the WordPress theme files to remove the timestamp. Secondly, the raw editing of such files do not provide flexibility. You can either keep the dates on all the posts or removed them all, there is no in between.

With that problem in mind Stephen decided to code a plugin, called Date Exclusion.

Date Exclusion Plugin

This WordPress plugin gives the user complete control over where and when the timestamp will be displayed. You can exclude them from all posts by default or only on posts older than a few weeks or months. You can also exclude or include dates on a post-by-post level through WordPress’ custom field feature.

Installation

  1. Download and unzip the plugin file
  2. Upload the date-exclusion.php file to your /wp-content/plugins/ directory
  3. Log into your WordPress control panel, click the “Plugins” tab, and click “Activate” next to the Date Exclusion plugin

Configuration

In order to configure the plugin for your needs you will have to open the plugin file (date-exclusion.php). You can do this on the Plugin Editor inside the WordPress control panel.

To exclude date information from all posts by default, set $exclude_date on line 30 equal to ‘yes’. This can be overridden on a post-by-post basis by setting “exclude_date” as a custom field with a value of “no”.

To set a default period of time for every post after which date information should no longer be displayed, set $date_expires on line 33 to the number of days to wait (e.g., 14 for two weeks). This can be overridden on a post-by-post basis by setting “date_expires” as a custom field with a different value (or 0 to deactivate).

To exclude date information from a specific post, set “exclude_date” as a custom field with a value of “yes”.

To make the date of a specific post no longer display after a certain period of time, set “date_expires” as a custom field with a value equal to the number of days you want the date to display.

Version History

Still on the initial release (1.0). Please leave a comment if you encounter any difficulties.

Share this article

85 thoughts on “Date Exclusion WordPress Plugin”

  1. I thought the idea of having plugins was, you don’t have to mess about with code.

    Why can’t all the setting be done on the, er… settings page?

    Reply
  2. Love the plugin but I have a question. I have my alt text showing on all my posts and the front page but the dates are still showing up on the other pages. Can you tell me how to set it up so the alt text shows on all posts and pages?

    Thanks!!

    Reply
  3. I’ve tried hundreds of combinations and I can’t get the date exclusion seo to work on my site. The dates remain on every page including the blog. I am using dragonskin – gold theme. Any help you can offer would be great. I don’t see line numbers … so i tried counting them to find the $exclude date , that didn’t work so i just started changing everywhere i saw this. Thanks for any help you can offer.

    Reply
  4. Stephen: I followed your instructions to: Set to ‘yes’ to exclude all date information by default; set to ‘no’ to deactivate
    $exclude_date = ‘yes’;

    I also added a custom field/value.

    I’m not sure what else to do to get this action to be effective in WP 3.0. Any ideas? Thank you in advance for your consideration.

    Reply
  5. hey it worked! :). i was looking everywhere how to get date excluded in WP but couldn’t find anything since i wanted my blog to not look like a blog. didn’t think a plugin was necessary to do the job. :-/ thanks soo much!

    Reply
  6. Hi! I love your plugin but want to delete date stamp from categories and actually all the dates.
    How do I do this?
    Thank-you in advance

    Reply
  7. Hi! I love your plugin but want to delete date stamp from categories and actually all the dates.
    How do I do this?
    Thank-you in advance,
    Dawn

    Reply
  8. Daniel, Stephen, Greg, et al –

    Like Steve (comment #30) & Trey (#58, #61) I like having dates on all the posts except the one or two sticky posts at the top of the homepage. Dates are very important on my blog, but having a date on the Welcome sticky really hits the visitor with an impression that the blog hasn’t been updated since Abel was in diapers.

    The instructions on how to edit the code to be able to select which posts don’t display a date just aren’t clear enough.

    Specific instructions, line by line, such as:
    Log into your WordPress dashboard
    Click on
    Then do this
    Then do that
    …as opposed to First go to Canada, then turn left…
    much needed and deeply appreciated.

    Please? and Thanks.

    Reply
  9. OK, so I figured out that that step happens right in WordPress… so please, help out us novices by saying something like.

    2. In your WordPress dashboard, select Plug-ins, Add New…

    …and so forth.

    Thanks!

    Reply
  10. I really appreciate helpful sites like you but need to point out that a sentence like this

    “Upload the date-exclusion.php file to your /wp-content/plugins/ directory”

    is like giving someone directions to Alaska by saying

    “Turn left when you get to Canada.”

    I have NO idea how to find my wp-content/plugins directory. I don’t have a clear idea how to upload it to that file if I knew where the destination folder was. I can’t be the only one who needs step-by-step instructions that assume no prior knowledge, start at A and proceed to Z without skipping any steps.

    Reply
    • [quote]`Upload the date-exclusion.php file to your /wp-content/plugins/ directory is like giving someone directions to Alaska by saying
      `Turn left when you get to Canada. I have NO idea how to find my wp-content/plugins directory…[/quote]

      then you probably have a wordpress.COM account. You have to have a wordpress.ORG account and learn/read (google! for instance) what wordpress is about. When you’ve never have been to Canada, and are planning to go there, you read about it, don’t you?

      Reply
  11. Its been a few months that you said that you would have an update for deleting timestamps from all categories and archives… Any news, any updates yet, its been forever… This would help many, many, many, many, many people alot…

    Reply
  12. Please help. I installed this plugin and couldn’t get it to display properly. So I just deactivated it and deleted it.

    But my site was left with this text displaying where the date was: “Updated at Least WeeklyUpdated at LeastWeekly.” I originally did enter ‘Updated at Least Weekly” as the text to display in place of the date on the front page.

    In addition, at the top of sidebar 1 right above my 1st widget, the text repeats again and looks like so: WeeklyUpdated at Least WeeklyUpdated at Least WeeklyUpdated at Least WeeklyUpdated at Least WeeklyUpdated at Least WeeklyUpdated at Least WeeklyUpdated at Least WeeklyUpdated at Least WeeklyUpdated at Least WeeklyUpdated at Least WeeklyUpdated at Least WeeklyUpdated at Least WeeklyUpdated at Least Weekly.

    It only appears in IE. Firefox looks fine.

    Please tell me what to do to get rid of this. The plugin is gone and that text is still there – in IE. I’m using WordPress 2.9.1.

    Anybody help me.

    Reply
  13. Success! I used “Set to the default number of days after which date information should no longer be displayed; set as 0 to deactivate
    $date_expires = 0;”

    I reset 0 to 3650 – ten years! Nine years from now I’ll have to change it, but now whenever I want to exclude a date from a post, I custom enter a posting date of 1910 (one hundred years ago…just to be safe). IT WORKS!

    Reply
  14. I want to exclude dates only on Calendar posts, which are actually calendar entries and end up with both the calendar date and the posting date. I can’t make this work. How do I “exclude date information from a specific post, set `exclude_date as a custom field with a value of `yes.”

    Where do I do this in the plugin php code? I created a custom field called “exclude_date” but that accomplished nothing.

    Reply
  15. For some reason this blog doesn’t show the line I put in the comments to disable the date.

    I saw that Pranab had the same problem.

    If you are interrested in the date exlusion follow me “guitarhabits” on twitter and search for the word “date exclusion” on my page.

    I’ll show you what to do. I’ll put it on right now.

    Klaus Tol

    Reply
  16. Hello everyone, I didn’t work for my either.

    You know what does work?

    search for this line:

    in 4 pages: archive.php, index.php, page.php and single.php and replace it for:

    Your dates are now gone in all the posts. Also in the categories.

    Date is gone on all the pages.

    Reply
  17. This plugin works for me on most blogs I had set up but I recently tried it on WordPress MU 2.8.4a and I get this error on every blog no matter what theme I use on a blog. Any ideas?

    Error! Options page not found.

    Reply
  18. Well I couldn’t get the plugin to work either, using WordPress 2.8, so I just edited the CSS file of my theme, commented out all styling related to date/time stamp and set that class to display:none; and in my case I also had to adjust the margin of class .posthead so that it lined up with the left margin (instead of leaving a gap on the left where the date used to be). Hope that might help someone. Seems to be working, for the “Bali” theme anyway.

    Reply
  19. >> `To exclude date information from a specific post, set `exclude_date as a custom field with a value of `yes.

    A number of people have asked for an example of how to set to a custom field? I ask for the same, please!

    Reply
  20. Guys,

    For those that’s didn’t make the whole things work. Note that you need to create a new directory [Which is a new folder] within the plugin folder to make it work.

    Example : public_html/wp_content/plugins folder/removetimestamp -> upload the date_exclusion into the folder [removetimestamp] and follow what it’s mention should do the trick. Hope this help

    Reply
  21. Just trying to set up my site and cannot for the life of me get this working. I’ve placed the date_exclusion.php in the public_html/wp_content/plugins folder (i think that’s right without looking, but basically where all of the other plugins i have are) and set the permissions to 744 (is that right), then when I go to use the editor in wordpress it gives me no option to save the amendments to the file.

    Any ideas?

    Reply
  22. Can someone PLEASE help me with my question above??

    I want to exclude the date on one specific post, but it is not working.

    Using the info listed above, I went to my post and added a custom field called exclude_date, typed yes in the value, updated, and then published the post. The date STILL shows below the title of the post.

    PLEASE HELP!!!! Thanks.

    Reply
  23. Hi
    great plug in
    I also did what iveto suggested re font size + it worked. So it worked on the whole index of posts + when a post is gone into.
    Thanks 🙂
    a

    Reply
  24. I installed Date Exclusion SEO today. I want to exclude the date on only one specific post.. is that option still possible?

    I followed the info in the Configuration section above: I went to edit the post, added a custom field called exclude_date, typed yes in the value, updated, and then published the post.

    The page of the post still shows the date below the title. Please help.. thanks!

    Reply
  25. Hey

    I have fixed the problems with the conflicts with WordPress 2.7 and incorporated the suggestions here.

    It is now checked into the WordPress Plugins Repository called Date Exclusion SEO. ( the name has to change because of conflict)

    Thanks

    Reply
  26. Ok oK just found out the way to remove the date and time stamp from the homepage too:

    All you have to do is to open the index.php file of your theme and look for the line:

    These are the functions that output the time/date. Just delete or comment them out.

    Done!

    Reply
  27. I was able to get this working on my 2.7 install. In the plugin, around line 35, I had to change this:

    // Add the names of any date-related functions you use in your templates
    $deactivated_functions = array(‘the_date’, ‘the_time’);

    to this:

    // Add the names of any date-related functions you use in your templates
    $deactivated_functions = array(‘the_date’, ‘the_time’, ‘get_the_time’);

    See the extra function on the end? I looked in my theme’s files and it was using “get_the_time” instead of just “the_time”.

    Hope that helps:)

    Reply
  28. I’m desperately trying to get the date exclusion plugin to work in wordpress version 2.7. However, I’ve come to the conclusion that this plugin is not compatible with that version. Can you confirm if that is correct andl let me know how to exclude the date from my posts? I’m pulling my hair out over here. Thanks!

    Reply

Leave a Comment