title: WordPress Loop Display Content if Have Posts
body: <pre><code>&lt;?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?&gt;
  </code></pre>
  
  <p>I'm using the loop to pull a few custom posts to display on the site. I have a designated <code>&lt;div&gt;</code> to hold the posts. I've run into the problem when there are no posts to be pulled, the div box still displays with no content in it. How would I insert the code of my div container within the "if" statement so that the div is only created if there are posts?</p>