auto archive functionality for posts

Is there a plug in or widget that allows posts to auto archive?
i.e. there is an event saturday 11/13/10 which I can schedule the publish date for....do I have to manually go in and archive/or delete that post or is there a function that I can use to have it "drop off" after the event date?

thanks!

  • Mason

    Hiya progresst,

    There's no way to really auto arichive posts that I know of. There's no box to check or switch you can toggle to achieve this. It's down to either posting some new material to push the older posts off the page or reducing the number of posts per page via Admin/Settings/Reading.

    You can set up a custom query in your theme that'll only display posts as of the last few days:
    <?php
    //Create a new filtering function that will add our where clause to the query
    function filter_where($where = '') {
    //posts in the last 10 days
    $where .= " AND post_date > '" . date('Y-m-d', strtotime('-10 days')) . "'";
    return $where;
    }
    // Register the filtering function
    add_filter('posts_where', 'filter_where');
    // Perform the query, the filter will be applied automatically
    query_posts($query_string);
    ?>

    Obviously you can tweak as needed. There's other ways to keep a post from displaying after the date has passed if that's what you're looking for.

    I'd recommend choosing something like that.

    For more info:
    http://codex.wordpress.org/Function_Reference/query_posts

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.