WordPress.org

Support

Support » How-To and Troubleshooting » blog to the future

blog to the future

  • ok, I was going to use WP for a gig calendar for a sax player’s site I’m designing now but it looks like entries don’t show up if the date is in the future? If I post in past or present, no prob, but if I change the time stamp to a future date, it desappear from the published blog… Still in the database and edit panel.
    Any idea?

Viewing 15 replies - 1 through 15 (of 46 total)
  • Correct, this is a feature. You can post in the future, but they do not show up until that time comes.

    Probably something that someone ought to write, since it comes up fairly often, but it wouldn’t be a weblog: one of the defining characteristics is that entries are displayed by date, newest entry first. If you have a gig in April you know about today, and enter it, and then next week add a date in March, then either you don’t display in reverse-chronological order, or you don’t display newest-item-first, and either way you’re doing something other than a blog.

    yes, it’s not a weblog. It’s a calendar of upcoming gigs. I think WP rules and I’d like to use it in a different way than the tipical blog. I understand the “feature” point of view, but it would still be neat to be able to override this. Too hard? Any ideas? Thx.

    OK, I didn’t think I was asking “The forbidden question.” I know they’re other scripts out there, bla bla bla… I like WP for its ease of use, and its PHP/MySQL back-end, and I’m used to customizing it since I use it for my blog. I think that not publishing stuff until today’s date is a cool feature, but I just wanted to know if there’s a simple way to override it since I believe this feature was added later on in the development. That’s all.
    On a side note, I think that if it was left as an on/off option in the admin area, it would open WP to a whole new world of possibilities. If the developers don’t want that, I’m no one to criticize their decision, it’s their baby, but I think mtanner and philor’s answers I got here are on the patronizing and useless side…

    I agree with Mister X, this should be something relatively easy to implement and would be a nice added feature. Maybe someone will come out with a hack for it.

    Relatively simple fix Mr X, find this line in your wp-blog-header.php:
    if ($pagenow != ‘post.php’ && $pagenow != ‘edit.php’) {
    if ((empty($poststart)) || (empty($postend)) || !($postend > $poststart)) {
    $where .= ‘ AND post_date <= \”.$now.’\”;
    }
    and replace with:
    if ($pagenow != ‘post.php’ && $pagenow != ‘edit.php’) {
    if ((empty($poststart)) || (empty($postend)) || !($postend > $poststart)) {
    //$where .= ‘ AND post_date <= \”.$now.’\”;
    }
    That way, everything will get posted (according to posts per page) irrespective of the “future” thing.

    I’ll check it out when I get home. Thanks! 🙂

    Works beautifully, amazing what two slashes can do… 😉

    🙂 Glad it worked for you! If I remember, I will try to create the little checkbox for posts so you can pick which ones should appeara head of time.

    Mr. X, I am using WP in the same fashion and wanted to show the “future dates”. But, I only wanted the future dates to show up in th e “schedule” category.. To make it work only for a particular category, add this to that same place in the code:

    if (!($cat == '5')) {
    $where .= ' AND post_date <= \''.$now.'\'';
    }

    Replace the “5” with the category ID of your schedule/events/upcoming page. All the other categories will work as normal and not show until the date happens.. It’s the best of both worlds.

    Actually, after playing with it, there is a more elegant solution. Consider the option of having a “look ahead” value (in terms of days).. What I have done was modify the code to add 45 days to the $now value.. That way WP returns all events coming up in the next 45 days.. This works for my particular application but may not work for everyone (we are only concerned with the schedule).. Because the site I’m working on has no future dated blog entries in any other category, all we get are the blog entries related to the schedule.. Pretty nice..
    Here’s the code:

    // generate the future offest (hour * 24 * days..)
    $future_offset = 3600 * 24 * 45;
    $now = date('Y-m-d H:i:s',(time() + ($time_difference * 3600) + $future_offset));

    Last thing.. With the implementation above, you can still pre-populate your schedule in advance and not be worried about ALL the entries showing up on the site at once. You get a nice sliding window of upcoming events..

    I put this hack in but how do you ALSO get it to show up on the calendar? I want the calendar to show posts (events) in the future weeks to let people know that on that particular day – something is going on.

    noslzzp,
    This is perfect. Just what I needed.
    Like Mr X, I too was looking for a hack to show advanced posts for an Events calendar plugin that I am working on, this was the perfect thing, thanks.

    This feature is just great. However it left me wondering about one thing. If you are are notifying the Update Services about this post, when will they be notified? When you originally save it, when it appears on the site or not at all?
    Keep up the great work!

Viewing 15 replies - 1 through 15 (of 46 total)
  • The topic ‘blog to the future’ is closed to new replies.
Skip to toolbar