title: Wordpress loop repeating within the foreach loop when listing child pages
body: <p>I've created a loop which is getting the correct child pages and their content, however it's staggering/repeating the page content on the foreach loop.</p>
  
  <p>The boxes (in order) should appear with the following content:</p>
  
  <p>Box 1: PRESS<br>
  Box 2: TV SHOWS<br>
  Box 3: Radio Shows<br>
  Box 4: Gallery  </p>
  
  <p>However as you can see it's doing the following:</p>
  
  <p>Box 1: Press<br>
  Box 2: Press, TV Shows<br>
  Box 3: Press, TV Shows, Radio Shows<br>
  Box 4: Press, TV Shows, Radio Shows, Gallery  </p>
  
  <pre><code>&lt;?php
      //get current page ID
      $the_id = get_the_ID();
  
      $args = array(
      'child_of'     =&gt; $the_id,
      'title_li'     =&gt; '',
      'parent'       =&gt; $the_id,
      'sort_order'    =&gt; 'DESC',
      'sort_column'   =&gt; 'menu_order'
      );
  
      $pages = get_pages( $args );
  
      $output = '';
  
      foreach($pages as $value){ ?&gt;
  
      &lt;div class="col-xs-12 col-sm-6"&gt;
          &lt;div class="row"&gt;
              &lt;div class="col-xs-12"&gt;
                  &lt;?php
                  $thumb = get_the_post_thumbnail( $value-&gt;ID, $attr = ' img-responsive' );
                  $output .= "&lt;div class='thumbnailcontainer'&gt;&lt;a href='" . $value-&gt;post_name . "' &gt;" . $thumb  . "&lt;span&gt;" . $value-&gt;post_title . "&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;";
  
                  echo $output;
  
                  ?&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;?php } ?&gt;
  </code></pre>
  
  <p>I tried limiting the posts_per_page to 1 but no difference.</p>
  
  <p><a href="https://i.stack.imgur.com/aqigN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aqigN.png" alt="enter image description here"></a></p>