WordPress.org

Forums

blog to the future (47 posts)

  1. Anonymous
    Unregistered
    Posted 11 years ago #

    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?

  2. Nick Momrik
    Member
    Posted 11 years ago #

    Correct, this is a feature. You can post in the future, but they do not show up until that time comes.

  3. philor
    Member
    Posted 11 years ago #

    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.

  4. Anonymous
    Unregistered
    Posted 11 years ago #

    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.

  5. MisterX
    Member
    Posted 11 years ago #

    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...

  6. Nick Momrik
    Member
    Posted 11 years ago #

    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.

  7. Laughinglizard
    Member
    Posted 11 years ago #

    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.

  8. Anonymous
    Unregistered
    Posted 11 years ago #

    I'll check it out when I get home. Thanks! :)

  9. Anonymous
    Unregistered
    Posted 11 years ago #

    Works beautifully, amazing what two slashes can do... ;)

  10. Laughinglizard
    Member
    Posted 11 years ago #

    :-) 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.

  11. Anonymous
    Unregistered
    Posted 11 years ago #

    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.

  12. Anonymous
    Unregistered
    Posted 11 years ago #

    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));

  13. Anonymous
    Unregistered
    Posted 11 years ago #

    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..

  14. pjtgrizzly
    Member
    Posted 11 years ago #

    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.

  15. Anonymous
    Unregistered
    Posted 10 years ago #

    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.

  16. poing
    Member
    Posted 10 years ago #

    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!

  17. Anonymous
    Unregistered
    Posted 10 years ago #

    i've also been trying to figure out how to get the calendar to show postings in the future. after some muddling through the code, i finally got it to work. its actually quite a simple modification.
    open up template-functions-general.php in the wp-includes directory. change line 415 from:
    AND post_date < '" . current_time('mysql') . '\'', ARRAY_N);
    to:
    AND post_date <> '" . current_time('mysql') . '\'', ARRAY_N);
    there also seems to be another pull from the database on line 439 which limits by the current date:
    ."AND post_date < '".current_time('mysql')."' "
    to:
    ."AND post_date <> '".current_time('mysql')."' "
    i'm not entirely sure what the change to line 439 seems to do, but i figure it doesn't seem to hurt anything. if anybody can provide a little more information on this, it'd be much appreciated.
    make sure you've edited the wp-blog-header.php file as described above to get the posts to actually show (not just on the calendar).
    it would be especially badass if someone (maybe i'll be able to figure it out myself) could modify the code so that if you're looking at your blog from a particular domain, or if the query_string had a certain variable in it (say dev=1), that the calendar would show future dates. or i suppose another way to work it would be to add a variable to the get_calendar function where if you call it with say get_calendar('dev'), it would show you the future dates. then on your index page, you could just add the php code to differentiate between a person who should be seeing the regular site and one who should be seeing the 'dev' site (showing future posts). hope that makes some sense.
    anyways, wanted to chime in that wordpress is quite a fantastic tool. been working with it for just a little while and i'm amazed with its quality and the support for it.

  18. Carfamuz
    Member
    Posted 10 years ago #

    Hi all,
    I have just installed the category specific/"blog to the future hack" on my installation of WP 1.2 Mingus at http://www.richmondyouthcentre.com - the programs page shows the future events from only category 2 (the programs category), and so does the calendar.
    However, when I accessed the RSS feed, I ran into trouble. The RSS feed doesn't show the future date posts.
    Here's my code so far:
    if ((empty($poststart)) || (empty($postend)) || !($postend > $poststart)) {
    //$where .= " AND post_date_gmt <= '$now'";
    //Future Date Hack :
    $now = gmdate('Y-m-d H:i:59');
    $where .= " AND post_date_gmt <= '$now'";
    } else {
    $future_offset = 3600 * 24 * 45;
    $now = date('Y-m-d H:i:s',(time() + ($time_difference * 3600) + $future_offset));
    $where .= " AND post_date_gmt <= '$now'";
    }
    }

    If someone could help me out, that would be great. Thanks in advance.

  19. Carfamuz
    Member
    Posted 10 years ago #

    Oops,
    that's really bad, my code above is missing an important line when I copied and pasted.
    Here's the code again

    if ((empty($poststart)) || (empty($postend)) || !($postend > $poststart)) {
    if (!($cat == '2' || $cat == '1')) {
    $now = gmdate('Y-m-d H:i:59');
    $where .= " AND post_date_gmt <= '$now'";
    } else {
    $future_offset = 3600 * 24 * 45;
    $now = date('Y-m-d H:i:s',(time() + ($time_difference * 3600) + $future_offset));
    $where .= " AND post_date_gmt <= '$now'";
    }
    }

  20. Anonymous
    Unregistered
    Posted 10 years ago #

    so, does anyone have this working and can walk us through the setup?

  21. Anonymous
    Unregistered
    Posted 10 years ago #

    Agreed, where exactly do we stick this code?

  22. Jack
    Member
    Posted 10 years ago #

    Hey, just read this post after finishing my own site for a small festival that still has to take place (in october). So I had this same problem. In the future I will defenitely use this hack, but for now I just wanted to mention my silly solution for php/wp dummies I came up with:
    I used customfields to enter and display the correct dates (like 'october 11th') for each event, but ordered all my posts/events by posting them in the pást. So each event was posted in from august 10th to august 18th, but the festival will take place in october 10th to october 18th. This way the order is correct and the pages will display in the same manner as always, like oldest on top or vice versa.
    Silly, I know, but it was eureka to me :) :)

  23. mrbrut
    Member
    Posted 10 years ago #

    Hi,
    This is all very confusing, does anyone have a step by step guide for putting upcoming events? Or does someone have this running that I can look at?
    I am only wanting upcoming events in the side bar of my site as links...
    My site is hornbag.net if interested.
    Many Thanks!

  24. mkenney
    Member
    Posted 10 years ago #

    I agree with everyone else looking for a complete walk thru on this hack... anyone up for it??
    What I'm looking for is future posts to show up in the calendar but not on the main page unless you use the calendar to go to that date.
    Any help in putting all these ideas together in a complete walk-thru I know would be appreciated by the rest of us peons.
    THANKS

  25. Anonymous
    Unregistered
    Posted 10 years ago #

    Hi,
    Following the hacks above I have the calendar & archives showing all the days/months in the future. I wanted to have 45-days out to be limited only when viewing the homepage (index.php)

    if ((empty($poststart)) || (empty($postend)) || !($postend > $poststart)) {
    if ($monthnum == '') {
    $future_offset = 3600 * 24 * 45;
    $now = date('Y-m-d H:i:s',(time() + ($time_difference * 3600) + $future_offset));
    $where .= " AND post_date_gmt <= '$now'";
    };
    }

    Basically it checks if $monthnum has a value. If it is blank we must be on the homepage.
    Cheers,
    Amanuel
    http://www.ticklespace.com

  26. amanuel
    Member
    Posted 10 years ago #

    Sorry, previous post is not correct.
    This is what I am using. The code show all events 45 days out from today only on the homepage.

    if ((empty($poststart)) || (empty($postend)) || !($postend > $poststart)) {
    if ($monthnum == '') {
    $begin_offset = 86400 * 1; // 86400 seconds in a day.
    $end_offset = 86400 * 45;
    $today = time() + ($time_difference * 3600);
    $start_time = date('Y-m-d H:i:s',($today - $begin_offset));
    $end_time = date('Y-m-d H:i:s',($today + $end_offset));
    $where .= " AND post_date_gmt <= '$end_time' AND post_date_gmt >= '$start_time'";
    };
    }

  27. crackerboy
    Member
    Posted 10 years ago #

    can you guys be more specific as to where exactly you're pasting this code (file names) and which (if any lines) are being removed or placed? thank in advance.

  28. Tom Atkins
    Member
    Posted 10 years ago #

    Anyone know how to do this for 1.5? The lines in wp-blogheader have changed.

  29. Tom Atkins
    Member
    Posted 10 years ago #

    OK, just worked it out for 1.5, in classes.php line 489 replace:

    $where .= " AND post_date_gmt <= '$now'";

    with

    $where .= " ";

    (the calender hack above still works)

  30. TechGnome
    Moderator
    Posted 10 years ago #

    There's a plugin available that will allow you to do this. I think Kitten wrote it... called "Event Calendar" if I remember right.....

    LEt me see if I can find it.

    Tg

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags