How to display future post in WordPress

This is small snippet to display all future posts starting today. Add this before doing the loop

<?php
function filter_where($where = '') {
  //posts in the last 30 days
  $where .= " AND post_date >= '". date('Y-m-d', strtotime('now')) . "'";
  return $where;
}
add_filter('posts_where', 'filter_where');
query_posts($query_string . "post_status=future,publish&orderby=date&order=ASC");
?>

You can limit the result or change order. See Codex for details of using query_posts

About Adi Setiawan

web developer, @startupbali initiator, ubuntu user, proud father. Living in-between space

12. July 2010 by Adi Setiawan
Categories: Website Development, Wordpress | Leave a comment

Leave a Reply

Required fields are marked *

*