I'm currently using the following code to make an event calendar that shows future events...
<?php query_posts('cat=4&showposts=-1&post_status=future&order=ASC'); ?>
The problem is, this removes the event on the day of the event. How do i write query that shows future posts through the day of the post (i.e. post date for Apr 25, 2010 would not fall off until Apr 26, 2010)
Thanks,
Rex
Monster Coder answers:
Hello,
this should solve your problem:
$posts = query_posts('post_status=future,publish');
foreach ($posts as $post){
$pm = date('m');
$pd = date('d');
$py = date('y');
if(strtotime($post->post_date) >= mktime(null,null,null,$pm,$pd,$py)){
echo $post->post_title .PHP_EOL;
}
}
it will list only a few posts. to increase number of posts, change the query using showposts.
$posts = query_posts('post_status=future,publish&showposts=50');
Rex Stevens comments:
This worked flawlessly, thank you!
David Bernhard answers:
Hey there, had the same issue too.
Solved this with a "Previous Events" block i found there: http://webdemar.com/wordpress/display-future-posts-in-your-wordpress-theme/
i hope i could help you
Regards
Rex Stevens comments:
This website wasn't exactly what i needed but thanks for answering.