1

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.

1

1 Answer 1

1

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/

3
  • 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? Commented Jan 28, 2012 at 19:24
  • @Chris Butler: Change showposts=5 to showposts=1 and put the full code into a Page Template(showposts=5) Commented Jan 30, 2012 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) Commented Jun 23, 2013 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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