• Got an issue that is doing my head in! This is what I want to achieve.

    I have an events section, which I want to work by scheduling the posts for the date of the event. I only want to show events in the future (scheduled) and not those in the past (published). This works fine on the homepage as I can just use post_status=future.

    However, I want to be able to sort these events by sport, using a custom taxonomy. When I view the taxonomy archive, it will obviously just display published posts and not scheduled posts.

    Can anyone recommend anyways I can get the taxonomy archive to display future posts but not published posts? Thanks for your time!

Viewing 1 replies (of 1 total)
  • Thread Starter tommysvr

    (@tommysvr)

    So I now have this, which successfully shows future posts on the taxonomy page. However, it still shows published posts as well. Anyone know of a way to modify this to hide published posts?

    if ( !is_admin() ) :
    function __include_future( $query )
    {
        if ( $query->is_tax() || $query->is_single() || $query->is_page() )
            $GLOBALS[ 'wp_post_statuses' ][ 'future' ]->public = true;
    }
    add_filter( 'pre_get_posts', '__include_future' );
    endif;
Viewing 1 replies (of 1 total)

The topic ‘Show Future Posts / Hide Published Posts’ is closed to new replies.