Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have been able to list out pages that are set for future in a custom template like this:

query_posts('post_type=page&post_status=future&posts_per_page=100&order=asc&orderby=date&meta_key=_wp_page_template&meta_value=show.php');

However, when I try to then click on one of the pages listed there I get a 404 (as a non-logged-in user).

How do I alter a thematic page.php template to show a future page?

We are already using a bunch of things in function.php and have a special page template for this particular type of post...

I tried adding the following to the functions.php with add_filter, but it didn't help:

function show_future_where($where) {
    return $where . ' AND (wp_posts.post_status = \'publish\' OR wp_posts.post_status = \'future\')';
}

BTW, I saw a post about automatically setting a post with a future date would be overridden with 'published' state, but couldn't get that to work.

If I can edit the page template is there something else I can do?

I am using 3.3, if that helps.

Thanks.

share|improve this question
    
Here is a solution –  Shazzad Dec 27 '13 at 10:56
add comment

1 Answer

Try this:

$my_query = new WP_Query(array(
    'post_status' => 'future',
    'order' => 'DESC',
    'posts_per_page' => 1,
));
while ($my_query->have_posts()) {
    $my_query->the_post();
    the_date();
    echo ' - ';
    the_title();
}
wp_reset_postdata();

or this: http://wordpress.org/extend/plugins/show-future-posts-on-single-post/

share|improve this answer
    
Thanks for responding, but this seems to show the last five posts that are marked future, right? I wanted to just show one post (page, actually) that is marked future on it's single post page... am I misunderstanding the solution? –  Chris Butler Jan 28 '12 at 19:24
    
@Chris Butler: Change showposts=5 to showposts=1 and put the full code into a Page Template(showposts=5) –  Jennifer M John Jan 30 '12 at 6:09
    
You should use posts_per_page param, and not showposts. The latter one is deprecated (it was replaced in 2.1, I guess) –  Krzysiek Dróżdż Jun 23 '13 at 11:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.