title: Wordpress - echo the password fields only once
body: <p>having some trouble:</p>
  
  <p>Basically, I have a page which displays custom posts, like blog posts. But I want the content to be private, and not be viewable until a password has been entered.</p>
  
  <p>I have cracked the password bit and you have to enter the password to view the posts all fine. BUT... For each "resident-mainarea-wrap" post that there is on the page it echos a password field and submit button.. So if I have 3 posts on the page it echos outs the "get_the_password_form" 3 times. They all work, but it looks messy, I only want one to be displayed.</p>
  
  <p>Basically I need to hide all the password fields that are echoed after the first one.</p>
  
  <p>Any help would be appreciated.</p>
  
  <pre><code>&lt;?php
  if ( !post_password_required() ) : ?&gt;
  
  &lt;img class="resident-image" src="&lt;?php echo $image; ?&gt;" /&gt;
  
      &lt;div class="resident-mainarea-wrap"&gt;
          &lt;div class="resident-mainarea"&gt;
              &lt;div class="resident-date"&gt;
                  &lt;?php echo $date; ?&gt;
              &lt;/div&gt;
              &lt;div class="resident-content"&gt;
                  &lt;?php echo $post_content; ?&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
  &lt;?php else: ?&gt;
  
      &lt;?php echo get_the_password_form(); ?&gt; 
  
  &lt;?php endif; ?&gt;
  </code></pre>