Using wp_query to pull content from a specific post using either title or id

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?

Related posts

Leave a Reply

2 comments

  1. If you know the post ID then you can use get_post($post_id); like so

    $post_id = 182;
    $my_post = get_post($post_id);
    $title = $my_post->post_title;
    echo $title;
    echo $my_post->post_content;
    

    ckeckout codex