I am trying to pull excerpts and custom fields from specific posts, I have tried using post titles and post id but I am only succeeding in pulling every single post using this query. For example I have this code trying to pull just the title for the post with id 182
<?php $map = new WP_Query();
$map->query('post_id=182'); ?>
<?php while ($map->have_posts()) : $map->the_post(); ?
<?php the_title(); ?>
<?php endwhile; ?>
It pulls the title of every single post using this method and I can not figure out how I am going to have multiple loops like this each pulling content from just one specific post. Can someone please explain where I went wrong?
I’ve had luck with
WP_query('p=182')
.If you know the post ID then you can use
get_post($post_id);
like sockeckout codex