title: How to run a loop inside the WordPress do_shortcode() function?
body: <p>Is it possible to run a loop inside the do_shortcode() function?</p>
  
  <p>Example:</p>
  
  <pre><code>echo do_shortcode('[iscorrect]'.$text_to_be_wrapped_in_shortcode.'[/iscorrect]');
  </code></pre>
  
  <p><a href="http://codex.wordpress.org/Function_Reference/do_shortcode" rel="nofollow">http://codex.wordpress.org/Function_Reference/do_shortcode</a></p>
  
  <p>I have tried creating a function to obtain the data and stick it in an array. Then for each item in that array, return the individual array value.</p>
  
  <p>Example:</p>
  
  <pre><code>function the_ips(){
      $ips = get_ips();
      foreach($ips as $ip){
          return $ip; 
      }
  }
  </code></pre>
  
  <p>I have dumped the array of data to be sure it has the correct data within it. Everything is correct. It continues to output the first value of the array within the do_shortcode() function, but nothing else.</p>
  
  <p>Here is what I have tried:</p>
  
  <pre><code>echo do_shortcode('[iscorrect]'.the_ips().'[/iscorrect]');
  </code></pre>
  
  <p>or</p>
  
  <pre><code>$content = '';
  $content .= '[iscorrect]';
  $ips = get_ips();
  foreach($ips as $ip){
      $content .= $ip;    
  }
  $content .= '[/iscorrect]';
  echo do_shortcode($content);
  </code></pre>
  
  <p>It still continues to produce the first result of the array and nothing else.</p>