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 tested it out. I don’t want the page t display date but I want the post to display date. I tested it out. It doesn’t work that way. Any solution? It seem when you activate the plugin all post and page will not date display.

    Reply
  2. None of the above worked for me… the date remained everywhere.

    So here is what I came up with-I know its retarded but it worked. In the CCS file using trial and error I discovered the tag responsible for styling the date and I made the font-size 0.

    here is a chunk of the code:

    small {
    font-family: ‘Trebuchet MS’;
    font-size: 0.0em;/*used to be 0.9em*/
    line-height: 1.5em;
    }
    Of course this may not work for some themes, but it works perfectly for mine!

    Reply
  3. HI, I’m in need of this plugin being upgraded to remove dates from category / archive pages. One of my sections is a diary from 1986 which I’m grouping together posts by month – it looks a bit odd with the heading saying Wednesday 1 January 1986 and a sub heading underneth saying 25 October 2008! Can I stress that the plugin does work for me for single post pages.

    Cheers

    Reply
  4. hi,

    thanx gawd for these comments or i would of been pullin’ hair out of my head. soooo okay, post date doesn’t show if shown as an individual post- great.

    i would like to know if a version is going to be made where a sticky post- on the home page can be viewed WITHOUT a datestamp? that would be cool.

    alex alaska p

    Reply
  5. Stephen, your plugin is working well for me (I am excluding all the dates). I do also wish to expand this to the categories. Email me if you can about how I can do this. Thanks a lot!

    Reply
  6. I can’t spell worth a damn.. or type worth a damn.

    I don’t know what a Healty guy is.

    Supposed to say Healthy Guy.

    sorry

    Reply
  7. I use WordPress for a number of different sites. For one project I’m using it as a small CMS, and as such I want to turn off the Time and Date functions as they are not that relevant to what I’m doing.

    So I searched and found this page. Unfortunately a year later the Plugin has not been updated to do more than turn single post dates off. This wasn’t enough for what I want to accomplish with this project.

    So I downloaded and installed the plug in (WP 2.5) and enabled it then turned on the feature with “Yes”. And the individual posts did in fact stop displaying dates. However there was a remnant from my template that did display and did not look good. And the dates were not removed from categories so it didn’t work on it’s own for my purpose.

    So I backed up the templates index.php and archive.php files. Then I removed 2 lines of code from each that execute the display of date and time.

    Next I edited the css file to remove the date png graphics.

    And it appears everything is now working fine with no time or date in the way.

    I am still using the plugin to disable display of time and date to the individual posts.

    WordPress has so much more potential if they would include “simple” features like date removal so it could be used much easier for a wider variety of applications.

    Reply
  8. See from previous posts that current plugin does not remove date from index.php.

    So, added code in the index.php to check for the exclude_date custom field and all working fine.

    Reply
  9. Further testing reveals that it works for a single post (single.php), but not for the mail index loop (index.php).

    Any ideas?

    Reply
  10. Just tried this on my wordpress 2.5 blog and can’t get it to work either for all posts, or for an individual post.

    Any ideas?

    My theme uses the the_time function.

    Reply
  11. Thanks for the plugin. Works perfectly with WP 2.3.3

    However, it just strips the date, and I am left with some non PHP blurb on each side of it, which doesn’t disappear.

    For example: “Written by PeterL on Dec. 13, 2007 at 4:00 pm”, becomes:

    “Written by PeterL on at ”

    Any ideas how to work around this?
    Peter

    Reply
  12. STEVE SAYS:
    “To exclude date information from a specific post, set `exclude_date as a custom field with a value of `yes.”

    Can you give an example of how to set to a custom field?

    Reply
  13. I want to exclude the date from my first sticky post only. Where do I set the custom field as described below? Thanks.

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

    Reply
  14. Seems to be working for me on the blog I set it up on. At first I thought it wasn’t working but after reading the comments, I realized it doesn’t work on the homepage posts but it does on the individual posts when you view them.

    Reply
  15. Got the plugin working nicely on WordPress MU – did have an issue with a few themes not working with it and they seemed to use only the_date and the_time functions – I’m not sure why they didn’t work but most do.

    Thanks for the great plugin.

    Reply
  16. Thanks for this plugin! I like the idea and could really use something like this for some of my blogs but need something that also pulls the date off the homepage post as well, not just single post.

    I know it has been a while since this was posted but were there ever any updates?

    Thanks again!

    Reply
  17. I’m playing with the plugin right now, here’s a clarification:

    1) Why are alot of people saying that nothing happened? It may be because of line 36 in date-exclusion.php:

    $deactivated_functions = array(‘the_date’, ‘the_time’);

    However, many themes like mine actually use another function, which I needed to add like this:

    $deactivated_functions = array(‘the_date’, ‘the_time’, ‘get_the_time’);

    Reply
  18. Hi,

    I thought this was the exact plugin I needed but I really need one that on a post by post basis gives me the option to remove the date stamp from posts on the home and category pages too.

    Any news on adding this functionality? Happy to donate something to have this as a working feature.

    Cheers

    David

    Reply
  19. Hello!

    I installed the plugin and it’s a great idea, but it only takes away the date from the posts and not anywhere else. I don’t mind having dates on the front page, but would prefer no dates anywhere else on the blog. Just removing dates from a post doesn’t really help when folks nav through the cats and see the dates… also the comments have dates too, so, although I like the idea of the plugin, it doesn’t really do a lot that is wanted — it is a great idea, just needs to be expanded… will you expand the plugin so that there are no dates to be found with the exception of the index or frontpage? Thanks tons!

    Bryan

    Reply
  20. This is so frustrating, Can someone please copy and paste the section I need to change for this to work.

    It says its defaultly set to exclude dates, but it doesn’t seem so because we have to make changes right? Then its not by default is it?

    Reply
  21. Ohhh- what about taking the time stamp from comments as well? Comments would obviously run longer if they weren’t dismissed over the time factor.

    Reply
  22. I’ve been waiting for a plugin like this since the first day I implemented WordPress on my sites. I think it’s absolutely essential that timestamps are removed from posts- they magically become referred to as “articles” rather than “posts” when the timestamp disappears which not only makes them “timeless” but also more credible, in a sense.

    I’d like the option to take them from the front page as well and on multiple post pages as well, but so far- this works great on most of my sites. Just one that it didn’t work on, but luckily, that’s just a frivolous site I have around for kicks and a little extra revenue. 😉

    Reply
  23. hi, thks for plugin. I’ve changed the $exclude date to yes as suggested. however the date and timestamp still shows on my first post as this is a new blogsite. I’m currently using justsimple free template..any help would be appreciated.

    thks

    clifford

    Reply
  24. Gives your blog a feeling of freshness by turning off the display of date information after a specified number of days or immediately after posting. Exclusion of date information can be set by default in the plugin file and/or manually for each post. Find the details, installation guide, configuration etc., at Daily Blog Tips

    Reply
  25. Thanks, that’s a great plugin especially to help those articles suiting all times. You could see it in action at my blog except the home page. I was in search for such a plugin all over the internet.

    Reply
  26. Thanks, that’s a great plugin especially to help those articles suiting all times. You could see it in action at my blog except the home page.

    Reply
  27. It would be very useful to be able to remove all timestamps. I am starting a wedding blog and the information there is timeless, so I would love to be able to remove dates from my archives as well.

    Reply
  28. I am not too technically proficient, hence I am putting the complete code here.

    if (! is_page()) { // Do not display if we are on a page
    // Date and author
    if (is_single()) { $articledate = get_the_time(‘j. F Y, G:i’) . ‘ Uhr’; } else { $articledate = get_the_time(‘j. F Y’); }

    Reply
  29. I like this plugin and it does work for single posts.

    I would LOVE to have it expanded for the index page as well as the category/archive pages 🙂

    Thanks for this contribution!

    Reply
  30. Out of curiosity, what are you using to display date information in your template, Trakin? The plugin works by disabling specific functions. The initial release only disables the_date() and the_time() by default.

    Something else I probably should’ve mentioned is that the plugin will only disable date functions on single post pages. Is there anyone who wants this feature expands to category and/or archive pages? If so, I’ll add it into the next release.

    Reply
  31. It does not seem to be working on my blog either. Actually, nothing happens – I st exclude date to “yes” and expire to 15 days and nothing happened. Infact I tried excluding dates from all the posts, but did not seem to work. Neither on single page – nor in category pages…Had to deactivate it…

    Reply
  32. Yeh – I did do that

    Odd I guess – must be conflciting with something else.

    Had to deactivate – I’ll try again when you release a new version

    Cheers

    Reply
  33. Oz, both Stephen and I tested the plugin, and it was working.

    After activating it, did you open the plugin file to configure it? Because just activating it will not make any change.

    Try opening the plugin file and setting the “$exclude_date” value to “yes”. Check if the dates are gone from the single post pages now (they should).

    Let me know how it goes.

    Reply
  34. Hi

    Sounds like a great plug in

    Unfortunately it was doing nothing for my site.

    Date was still being stamped on each post.

    Any ideas ?

    Reply
    • I would also like to lose the date option on my news items.

      I downloaded and added your plugin and activated it. I then edited it as per your instructions. However due to the permissions settings it wasn’t possible to save the changes in WordPress.

      So I then edited it via the back end of my website using text wrangler. The changes then appeared on the text of the plugin on my website, so I know I managed to do it ok.

      However the date is still showing. I am now wondering whether I did the correct editing? I set the date to expire on the post after 2 days but left the other lines alone.

      I didn’t edit anything in the area where it said don’t edit below this line.

      Any help would be appreciated (and thank you for taking the time to make this plugin)

      Reply
  35. looks good i use /%category%/%postname%/ for some blogs, in custom permalink, but it would be good to have option to switch between blogs, although it might look a bit strange to keep switching url style

    Reply

Leave a Comment