Display future regardless of date
-
Is there any way that I can make posts show no matter of the date they’re posted?
So posts I post today (in March) and give the date of July will go ahead and show now… instead of waiting until the day the entered in the time stamp.
I know about the Event Calendar plug-in, but this doesn’t do what I’m wanting. I just want posts to display even if they’re in the “future”.
-
This was an easy find / fix… just took some research.
The easiest way to do this is with “The Future is Now” plgin-in.This is how I display future dates from my ‘Gigs’ category, without resorting to plugins or modifying core WP code …
<?php $my_query = new WP_Query('category_name=gigs&post_status=future&order=ASC'); while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID; ?>
Works in later versions of WP 2.xx.
For full details …
I don’t think we’ll be entering future events that we don’t want displayed, so what I did is tweak the code in ../wp-includes/post.php:
if ( 'publish' == $post_status ) { $now = gmdate('Y-m-d H:i:59'); if ( mysql2date('U', $post_date_gmt) > mysql2date('U', $now) ) // changed so that future dates will be displayed // $post_status = 'future'; $post_status = 'publish'; }
Best, Vicki
How does the above work so that future posts are displayed, but once they are in the past they don’t?
I’ve tried Keith Millington’s code, but it gives a 404 not found error when non-logged in users try to read the post 🙁
- The topic ‘Display future regardless of date’ is closed to new replies.