WordPress.org

Support

Support » Plugins and Hacks » Future Post listings in WP 2.1

Future Post listings in WP 2.1

  • Future Post seems to be broken in the new super fantastic WordPress 2.1. The site I’m using it gives an events calendar with future posts/events being shown

    I had previously also made manual changes to the classes.php to enable listing of ALL posts not just ones with a dates from today backwards….

    I’ve spent my afternoon searching through the source code and can’t find the bit where the date settings are made.

    Previously you could change/remove a line such as –
    $where .= ” AND post_date_gmt <= ‘$now'”;

    Can some one point me in the right direction?
    Thanks

Viewing 15 replies - 1 through 15 (of 33 total)
  • That original change was in classes.php btw.
    Any help on this would be great.
    If people have got futureposts plugin actually working it would be good to know too – just in case I am a complete spaz and missing something.

    We’re using WordPress MU and Future Posts are not showing up at all. They get saved and placed in the manage posts list, but they don’t get published onto the site.

    I tried a standalone WP 2.1 and same thing, the post doesn’t show up.

    I managed to hack around with the posts.php and found that future dated posts are published to the database with the post_status of FUTURE. If you modify this to PUBLISH your posts will turn up.

    The modified posts.php is here.

    If I can work out how to, I will hopefully be able to modify the old plugin to change the necessary code in WP2.1. For now the patched file just posts all published posts as PUBLISH regardless of date.

    Or should I sat it’s here. Sorry.

    I found that in WordPress 2.0.7 classes.php can also be edited.

    I use the event calendar plugin but also found i needed to set the post timestamp due to the way I wanted my blog to work for my needs.

    Starting at line 591 in classes.php:

    $now = gmdate('Y-m-d H:i:59');
    Change to:

    $now = explode('-',gmdate('Y-m-d H:i:59'));
    $now = $now[0]+1 . '-' . $now[1] . '-' . $now[2] . $now[3];

    This sets the now date forward 1 year.

    And at line 595 in classes.php:

    if ($pagenow != 'post.php' && $pagenow != 'edit.php' && !($this->is_single && $user_ID)) {

    Change to:

    if ($pagenow != 'post.php' && $pagenow != 'edit.php' && !($this->is_single)) {

    I wouldn’t know if this works for any version other than 2.0.7 and im also unsure if this is indeed correct, but for now, it seems to work.

    For anyone else editing the WordPress files, please remember your work will be undone when you update.

    Thanks for this detailed information, I have the same needs for future event posting.

    I just installed the new new version of wordpress 2.12 so i’m going to try this on it, and give any feedback here if it works – or doesn’t.

    future posting does not work in 2.1.2 :-(((

    Radek

    @lotech: Thank you very much for the work. The hack in post.php works fine for me in WP 2.1.2!
    For some uses this is just great – for example when using WordPress more as an content-management-system and with hand-coded queries in one’s templates to sort and display content/posts (not relying on the standard-Loop). With your hack one can have a “future posts”-category even without plugins…

    I get a blank page when I try to use this post.php.

    Using WP 2.1.3

    I found an easy solution for this:

    open -> /wp-includes/post.php
    goTo -> #562
    edit -> $post_status = ‘future’;
    to -> $post_status = ‘publish’;

    Now your future posts are saved in the database as ‘publish’ when you create a new post or when you update your future posts.

    Example: http://cloetensbrecht.be

    That’s an idea… thanks cloetensbrecht 🙂
    Have to figure out what posts to show though, since (as your demo shows) it will show all the posts, even ones far in advance… might be confusing for a few visitors.

    I have a “Coming Soon” plugin that lists the title of future scheduled posts and the date they are scheduled to appear. It is designed for the sidebar. If anyone wants it is is available at my dev site http://tukats.net/blog/2007/03/28/coming-attractions/. It works in 2.1. Haven’t tested it in 2.2 yet.

    Thanks for the info, emhouston! 🙂 Is it possible for the user to click on the title and be taken to the post content at all?

    Right now it isn’t because I’m using it for serialized fiction and I don’t want users to read it before it goes ‘live’, I want them to sub to get it or come back to the site. That would be an easy hack though…

    Thanks for the reply 🙂 I will be using it for upcoming events/competitions, so it would be useful for visitors to click to see more details. I’m no PHP expert, so would I be able to contact you to find out more about the ‘hack’ at all please?

Viewing 15 replies - 1 through 15 (of 33 total)
  • The topic ‘Future Post listings in WP 2.1’ is closed to new replies.
Skip to toolbar