title: display none the div if content is null
body: <p>I have a content that is wrap in a div generated by a <code>the_content</code>. it is possible that the content is null it generates nothing but i want to hide the div that is wrapping the content.</p>
  
  <p>What I have done is put it in a loop now once I have declared the <code>$pageContent</code> its not working or the declaration of the variable is generating it although its my main point is to store the value to that function. Below is what I have done.</p>
  
  <pre><code>&lt;div id="content" class="clearfix row"&gt;
      &lt;div id="main" class="col col-md-12 clearfix" role="main"&gt;
          &lt;?php if ( have_posts() ) {
              while ( have_posts() ) {
                  the_post();
                  the_content();
                  $thispage=$post-&gt;ID;
              }
          } ?&gt;
          &lt;div class="page-header"&gt;&lt;h1&gt;&lt;?php the_title(); ?&gt;&lt;/h1&gt;&lt;/div&gt;
  
      &lt;?php $childpages = query_posts('orderby=menu_order&amp;order=asc&amp;post_type=page&amp;post_parent='.$thispage);
          if($childpages){ 
                  echo '&lt;div class="page-content"&gt;';
                  foreach ($childpages as $post) :
                  setup_postdata($post); ?&gt;
                  &lt;article id="post-&lt;?php the_ID(); ?&gt;" &lt;?php post_class('clearfix'); ?&gt; role="article"&gt;
                          &lt;h2&gt;&lt;?php the_title(); ?&gt;&lt;/h2&gt;
                      &lt;div class="page-image img-responsive"&gt;&lt;?php the_post_thumbnail(full);?&gt;&lt;/div&gt;
                      &lt;?php 
                          if ($pageContent-&gt;the_content != '') {
                              echo '&lt;div class="page-content"&gt;'.$pageContent.'&lt;/div&gt;'; }
                          }   
                      ?&gt;
                  &lt;/article&gt;      
           &lt;?php
                endforeach;
                  echo '&lt;/div&gt;';
           } ?&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This is whats not working.</p>
  
  <pre><code>&lt;?php 
                          if ($pageContent-&gt;the_content != '') {
                              echo '&lt;div class="page-content"&gt;'.$pageContent.'&lt;/div&gt;'; }
                          }   
                      ?&gt;
  </code></pre>
  
  <p>Generally I would replace the code with this in order to work. which is generating the div even in null condition of the content.</p>
  
  <pre><code>&lt;div class="page-content"&gt;&lt;?php the_content();?&gt;&lt;/div&gt;
  </code></pre>
  
  <p>and this also works which is I think should be wrong. the $<code>pageContent = the_content();</code> is generating the content rather than the if condition.</p>
  
  <pre><code>                &lt;?php 
                      $pageContent = the_content();
              if ($pageContent != '') {
                  echo '&lt;div class="page-content"&gt;'.$pageContent.'&lt;/div&gt;'; 
              }   
                  ?&gt;
  </code></pre>