Monday, June 28, 2010

Show future posts on single post

today i show how to display future posts in single.php. you just copy code below into funciton.php.

add_filter('the_posts', 'show_future_posts');

function show_future_posts($posts)
{
global $wp_query, $wpdb;

if(is_single() && $wp_query->post_count == 0)
{
$posts = $wpdb->get_results($wp_query->request);
}

return $posts;
}

No comments:

Post a Comment