title: $post is null while in the loop
body: <p>According to WP documentation this can't be happening but it is:</p>
  
  <p><a href="http://codex.wordpress.org/The_Loop" rel="nofollow">http://codex.wordpress.org/The_Loop</a></p>
  
  <blockquote>
    <p>You can display other information about each post using the
    appropriate Template Tags or (for advanced users) by accessing the
    $post variable, which is set with the current post's information while
    The Loop is running.</p>
  </blockquote>
  
  <p>All following code examples use $post to access the current post but I can't. Even though it goes in the loop $post is null:</p>
  
  <pre><code>$args = array('post_type' =&gt; 'carousel_bootstrap', 'posts_per_page' =&gt; 10);
  $loop = new WP_Query($args);
  while ($loop-&gt;have_posts()) : $loop-&gt;the_post();
      var_dump($post-&gt;ID);//=NULL
      $title=the_title(null,null,false);
      var_dump($title);//string(4) "NOPE"
  ....
  endwhile;
  wp_reset_postdata();
  </code></pre>
  
  <p>So either $post should not be null or the var_dump should not execute in the loop. I need to access this current post's custom fields but can't do it if $post is null. To make it more confusing; in the next line the $title variable is set to the current post's title.</p>
  
  <p>How would I go about solving this? Using word press 3.6.1</p>
  
  <p><strong>[UPDATE]</strong></p>
  
  <p>I made a custom post called carousel, thought I'd use it to contain the html code for a twitter bootstrap carousel. In header I'm calling a function that checks if a custom carousel post exist with a certain name (provided by a custom value from the page). </p>
  
  <p>In the header $post is the page, in the function checking the custom post the $post is null and when exiting the function and continuing in the header $post is the custom post (no longer the page).</p>
  
  <p>Seemed like a good idea to do it this way when I started but looks like it can't be done this way.</p>