views:

20

answers:

1

I am helping a company that handles events.

They tend to publish all their posts forward dated.

by default the wordpress calendar only display up to today

How do I overwrite it so it shows all the posts, even the forward dated ones?

+1  A: 

Not regarding to the calendar specifically, but this is what I use to get future posts. You can change the post type to whatever you want if you have custom post types registered, for instance events, etc.

add_filter('the_posts', 'show_future_posts');
add_filter('pre_get_posts', 'include_future_posts');

// Show future posts when available
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;
}

// Show future posts in standard queries for afisha
function include_future_posts($query) 
{
    if ($query->query_vars['post_type'] == 'cheers' && !is_admin())
        $query->query_vars['post_status'] = 'publish,future';
    return $query;
}

The !is_admin in the include_future_posts function is required for the admin side to work correctly with draft, published and scheduled posts. Remove it to see what happens otherwise.

kovshenin