making a event list with future dates wordpress (12 posts)

  1. yochee
    Posted 6 years ago #

    its strange, that there isnt any possibility in the admin-panel to enable the displaying of posts with the status "future".

    yes, i already know the "future is now" and "show future" plugins, but all they do is changing the status to publish, but i need the future status because when time passes by the posts just automaticly change their status to publish, and thats great, can be done with this core hack:

    but its stupid messing around with the core, you will have to do this after every update. there is a bunch of people out there with the same problem, solving it by messing around with the core, writing functions.php oder event-calendar plugins (entering the date for the event twice) for wp, and still their future post wont shop up in the rss-feed or calendar. there are some threads about this:

  2. http://wordpress.org/support/topic/276841?replies=7
  3. http://webdemar.com/wordpress/display-future-posts-in-your-wordpress-theme/
  4. http://forum.wordpress-deutschland.org/konfiguration/42106-moechte-beitraege-mit-post_status-future-suchergebnissen-anzeigen-lassen.html
  5. http://dominicfallows.co.uk/2008/02/24/show-future-posts-in-wordpress-23/
  6. ...

    so please anyone out there:

    add a function to display future post now into the admin-panel!!

  • Stian Andreassen
    Posted 6 years ago #

    You can easily make your own SQL-query that fetches future posts by the status «future»:

    global $wpdb;
    $mysql = "SELECT wposts.* FROM $wpdb->posts wposts WHERE wposts.post_status LIKE 'future' ORDER BY wposts.post_date ASC";
    $futureposts = $wpdb->get_results($mysql, ARRAY_A);
    	if($futureposts) :
    		foreach ($futureposts as $future) :
    			echo date('d.m.Y', strtotime($future['post_date'])).': ';
    			echo '<a href="'.get_permalink($future['ID']).'">';
    			echo $future['post_title'];
    			echo '</a><br />';

    Put this in a template-file, and it will output all future posts with the future-date and links to the post. No need to muck about with the core.

  • yochee
    Posted 6 years ago #

    no, this doesn´t help, because the posts won´t show up in the rss-feed.

    actually, i did something like this but because of the rss-thing I´m not quite satisfied with it.

    it would be much easier if there would be the possibility to show/hide future posts/drafts in the admin panel

  • larsbachmann
    Posted 6 years ago #


    Did you solved the problem with future post in RSS feed? I'm having the same problem.

  • mrgtb
    Posted 6 years ago #

    I agree about this, for example I'm posting movie information about films coming in the future. It's no use to me that movie only being published live for reading (on that date) 6 months from now that I write for people to know about now. I still want to add it to the correct date it gets released for watching, so dates match-up. But I want people to be able to read that post now, not in 6 months time when the movie is already with us.

    There should be a default setting in wordpress that shows all future posts still live to be read, or at least to give you the option to do it, or not.

  • jairo.ochoa
    Posted 6 years ago #

    I'm agree.
    If future posts could be readed, we can use them as events. The easiest way to make an agenda.
    But only if logged as admin I can read them.

    I know there are events plugins but this is enought for me, I do not need extra options.


  • soulsizzle
    Posted 6 years ago #

    The following code is a good starting point. Just add it to your functions.php file.

    function show_any_post_status($queryVars) {
    	$queryVars->query_vars['post_status'] = 'any';
    	return $queryVars; // Return our modified query variables
    add_filter('pre_get_posts', 'show_any_post_status');

    There are a number of issues with this code depending on your theme and particular situation. There is no way to show a particular combination of post statuses, like 'publish' and 'future'. So this code shows ALL of them, including drafts (but not Trash).

  • jairo.ochoa
    Posted 6 years ago #

    Now I can make a list of publish and future post, but I cannot make them viewable on a single page, I can only see publish post and if I click on a future one it is show the most future one.

    Any suggestion?

  • joehuffman2
    Posted 6 years ago #

    I think ht ebest way to go about showing events is to not include publish date altogether. For one reason, there is so many other functions that rely on the publish date to show the post.

    My suggestion is that you should use a post-type or custom field with numbers representing the date (may 3rd, 2010 = XXXXYYZZ = 20100503 )and have the number parsed on the front (XXXX = yeaar, YY = monnth, ZZ = day ), and then you could sort those, include/exclude etc.

    You won't enocunter nearly as many problems, and you won't have to rely on functions that deal with core pieces of the wordpress cms. As well, you could add custom fields to rss feeds.

  • mariostukela
    Posted 6 years ago #

    I think adding custom fields to rss feeds would be the easiest way for now. In fact, I do it this way for months and as long as there's no cool workaround, it will be the best to keep it like it.

  • torsteino
    Posted 6 years ago #

    I am working on something similar to this, with roughly the same approach joehuffman2 suggests. I have a custom post type called "calendar", where I have a meta field for date, on the form YYYY.MM.DD

    On the front page, I show 10 of these calendar events in the sidebar, sorted by date, ascending, so the first event will be on top, and this far it works fine. But how can I make them disappear when that date has passed? I'd like the events to still be published, I just dont want them in the calendar on the front page

    This is the query I use now, which works, except that the events dont disappear when I'd like them to:


    I'm thinking something like

    $today = date("Y.m.d") ;

    but I'm obviously doing something wrong.

    I probably need to get this explained _really_ basic... PHP & such aint my strong side...

  • torsteino
    Posted 5 years ago #

    It turned out to be as simple as this:

    $today = date("Y.m.d") ;

    For anyone else struggling with similar things: Note the double quotes around the query instead of single quotes, and


    not just (correct form above, wrong below)


    What went wrong at first in addition to the single quotes, was how to use the "meta_compare". I figured it would use the same meta_value I already had chosen, but it must be chosen specifically for the meta_compare also.

    Here I have a custom post type called "calendar", with a custom field called "eventdate" where the event date is entered on the form YYYY.MM.DD. Then this query orders the calendar events according to the eventdate, only showing events where the "eventdate" is today or in the future.

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic