title: Wordpress echo something in for loop only once
body: <p>So I'm trying to print some labels only once, there are four labels per loop.</p>
  
  <p>So esentially i'm trying to loop through and print the labels once per label.</p>
  
  <p>At the second it is printing the four labels per loop.</p>
  
  <p>To better explain here are some pictures.</p>
  
  <p>What I want - <a href="https://i.imgur.com/LPbqd53.png" rel="nofollow noreferrer">http://i.imgur.com/LPbqd53.png</a>
  What it currently is - <a href="https://i.imgur.com/WqNrgBc.png" rel="nofollow noreferrer">http://i.imgur.com/WqNrgBc.png</a></p>
  
  <p>Here is my code</p>
  
  <pre><code>  &lt;div class="wpt_test fill_form"&gt;
  
      &lt;div class="answers"&gt;
        &lt;div class="content"&gt;
          &lt;form
          &lt;?php foreach ($formAttributes as $key =&gt; $value):?&gt;
            &lt;?php echo $key ?&gt;="&lt;?php echo htmlspecialchars(is_array($value) ? json_encode($value) : $value) ?&gt;"
          &lt;?php endforeach; ?&gt;&gt;
          &lt;?php if ($isShowContent): ?&gt;&lt;div class="content" style="margin:0;"&gt;&lt;?php echo $content ?&gt;&lt;/div&gt;&lt;?php endif ?&gt;    
          &lt;?php if ($shortDescription): ?&gt;&lt;div class="short-description"&gt;&lt;?php echo $wp-&gt;autoParagraphise($shortDescription) ?&gt;&lt;/div&gt;&lt;?php endif ?&gt;
          &lt;?php $wp-&gt;doAction('wp_testing_template_fill_form_questions_before') ?&gt;                            
            &lt;?php foreach($questions as $q =&gt; $question): /* @var $question WpTesting_Model_Question */ ?&gt;
              &lt;?php $wp-&gt;doAction('wp_testing_template_fill_form_question_before', $question, $q) ?&gt;
            &lt;div class="question"&gt;      
                &lt;div class="title"&gt;
                &lt;span class="question-title" style="width:100%;"&gt;&lt;?php echo $question-&gt;getTitle() ?&gt;
                  &lt;?php $wp-&gt;doAction('wp_testing_template_fill_form_label_end', array('required' =&gt; true)) ?&gt;&lt;/span&gt;
                  &lt;?php if (!$isMultipleAnswers): ?&gt;
                    &lt;input type="hidden" name="&lt;?php echo $answerIdName ?&gt;[&lt;?php echo $answerIndex ?&gt;]" value="" /&gt;
                  &lt;?php endif ?&gt;
                &lt;/div&gt;
                &lt;div class="answer-block"&gt;
                  &lt;?php foreach($question-&gt;buildAnswers() as $a =&gt; $answer): /* @var $answer WpTesting_Model_Answer */ ?&gt;
                    &lt;?php $answerId = 'wpt-test-question-' . $question-&gt;getId() . '-answer-' . $answer-&gt;getId() ?&gt;
                    &lt;div class="question-titles"&gt;
                      &lt;div class="question-labels"&gt;
                      &lt;label for="&lt;?php echo $answerId ?&gt;"&gt;
                          &lt;input type="&lt;?php echo $isMultipleAnswers ? 'checkbox' : 'radio' ?&gt;" id="&lt;?php echo $answerId ?&gt;"
                              data-errormessage="&lt;?php echo $isMultipleAnswers
                                  ? __('Please select at least one answer.', 'wp-testing')
                                  : __('Please choose only one answer.', 'wp-testing') ?&gt;"
                              &lt;?php if (0 == $a): ?&gt;required="required" aria-required="true"&lt;?php endif ?&gt;
                              name="&lt;?php echo $answerIdName ?&gt;[&lt;?php echo $answerIndex ?&gt;]" value="&lt;?php echo $answer-&gt;getId() ?&gt;" /&gt;
                          &lt;?php echo $answer-&gt;getTitleOnce() ?&gt;
                      &lt;/label&gt;     
                      &lt;/div&gt;  
                    &lt;/div&gt;  
                    &lt;?php if ($isMultipleAnswers) {$answerIndex++;} ?&gt;
                  &lt;?php endforeach ?&gt;
                &lt;/div&gt;
                &lt;?php $wp-&gt;doAction('wp_testing_template_fill_form_question_after', $question, $q) ?&gt;
                &lt;?php if (!$isMultipleAnswers) {$answerIndex++;} ?&gt;
              &lt;?php endforeach ?&gt;
            &lt;/div&gt;
  
            &lt;?php $wp-&gt;doAction('wp_testing_template_fill_form_questions_after') ?&gt;
  
            &lt;?php if($isFinal): ?&gt;
              &lt;p&gt;
                &lt;input type="submit" class="button" value="&lt;?php echo $submitButtonCaption ?&gt;" /&gt;
                &lt;?php if($stepsCounter): ?&gt;&lt;span class="steps-counter"&gt;&lt;?php echo $stepsCounter ?&gt;&lt;/span&gt;&lt;?php endif ?&gt;
              &lt;/p&gt;
            &lt;?php else: ?&gt;
              &lt;div class="wpt_warning"&gt;
                &lt;h4&gt;&lt;?php echo __('Test is under construction', 'wp-testing') ?&gt;&lt;/h4&gt;
                &lt;p&gt;&lt;?php echo __('You can not get any results from it yet.', 'wp-testing') ?&gt;&lt;/p&gt;
              &lt;/div&gt;
            &lt;?php endif ?&gt;
            &lt;?php foreach($hiddens as $name =&gt; $value): ?&gt;&lt;input type="hidden" name="&lt;?php echo htmlspecialchars($name) ?&gt;" value="&lt;?php echo htmlspecialchars($value) ?&gt;" /&gt;&lt;?php endforeach ?&gt;
          &lt;/form&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  
    &lt;/div&gt;
  </code></pre>