Site icon Hip-Hop Website Design and Development

Show only oldest post by author

I am working with a heavily customized install of WP. I’ve set up a specific post type, taxonomy, and roles that gets to use just that post type.

Ideally, I’d like to restrict members of that role using that post type to only create one post. This seems like it might be more trouble than it’s worth. So barring that, I’d like to display only the oldest of their posts in an archive view.

I’ve got the following, which creates a workable archive loop, but I haven’t figured out the “if number of posts > 1 then show only oldest post” bit.

    $args = array
    ('post_type' => 'ticketlisting',
        'posts_per_page' => 50,
        'tax_query' => array
        (array
            (
            'taxonomy' => 'tier',
            'field' => 'slug',
            'terms' => 'goldstar'
            )
        )
    );

$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
    the_title();
    echo '<div class="entry-content">';
    $post_id = get_the_ID();
    /* show post content here */
    echo '</div>';
endwhile;