custom post type upcoming post and past post

For Future Posts, you can just have Published Posts that are scheduled for the future. When editing a post, you can click on Edit beside “Publish Immediately” and select a date/time.

You can then have a subloop get all posts with the post_status of future. That should work just fine for you!

WP_Query documentation

Future:

$query = new WP_Query( array(
    'post_status' => 'future',
    'orderby' => 'date', 
    'order' => 'ASC', 
    'posts_per_page' => 1 
) );

if( $query->have_posts() ) {
    while( $query->have_posts() ) {
        $query->the_post();
        echo the_title();
    }
}

Oldest

$query = new WP_Query( array(
    'orderby' => 'date', 
    'order' => 'ASC', 
    'posts_per_page' => 1 
) );

if( $query->have_posts() ) {
    while( $query->have_posts() ) {
        $query->the_post();
        echo the_title();
    }
}

Leave a Comment