Schedule Sticky Posts

The issue is that you limit query to the two possible posts, but by default it will ignore the future one (since that’s the point of it not being published yet).

Also the ID order is not guaranteed to be same as date order. ID is reserved when post is first created but date it is published can be freely manipulated.

And query_posts() is evil and should not be used.

So your query should be something like this (not tested):

$sticky = new WP_Query( array(
    'post__in'            => get_option( 'sticky_posts' ),
    'posts_per_page'      => 2,
    'ignore_sticky_posts' => true,
    // date descending is default sort so we don't need it explicitly
) );

while ( $sticky->have_posts() ) : $sticky->the_post();
    the_title();
    the_excerpt();
endwhile;

wp_reset_postdata();

Leave a Comment