Reputation: 233
I have a post-type called 'test'.
I'd like to render a specific post from that post-type.
I'm assuming I specify the post's ID to do that.
After some Googling this where I've ended up, but it shows all the posts, not just the Post with an ID of 1.
<?php $loop = new WP_Query( array('post_id' => 1, 'post_type' => 'test', 'posts_per_page' => 10) ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
Anyone have any idea? Any help would be greatly appreciated. Thanks!
Upvotes: 0
Views: 107
Reputation: 26451
For specific post Id variable is p
& not post_id
, Try this.
$loop = new WP_Query( array('p' => 1, 'post_type' => 'test', 'posts_per_page' => 10) );
Upvotes: 2