Exclude a specific post in a Custom Post Type
I have a very simple query to display all my posts in a custom post type:
?php
$page = get_page_by_title('Duck');
$args = array(
'post_type' = 'sessions',
'post__not_in' = array($page-ID)
);
$query = new WP_Query( $args );
?
?php if ( $query-have_posts() ) { ?
ul
?php while ( $query-have_posts() ) { $query-the_post(); ?
li
?php the_title(); ?
?php the_content(); ?
/li
?php } ?
/ul
?php } ?
?php wp_reset_postdata(); ?
What I want to do is display all the posts except the Duck
post, I'm getting it's ID by it's name - which normally isn't a problem, but the query still shows this post. I'm guessing I'm just not going about this the right way.
Can anyone help me out here, I was also thinking exclude $page-ID
or something like that - which is what I'd do in a regular loop...just not sure how to do it in a Custom Post Type.
Thanks,
Josh