title: Wordpress; Convert array of image ids to urls
body: <p>I'm building a theme from scratch and am utilizing the Visual Composer plugin.</p>
  
  <p>I've made a custom element using VC to allow a user to upload a set of images.</p>
  
  <p>When a users selects a set of images, they get returned as an array of image ids.</p>
  
  <p>I'm trying to create a shortcode that will convert that array of ids to an array of <code>src</code> elements.</p>
  
  <p>I know I have to use a <code>foreach</code> loop, but after hours of looking online I can't seem to figure out how to write it correctly. Obviously just learning here, so be gentle ;)</p>
  
  <p>My code that makes the custom VC element looks like this (edited down):</p>
  
  <pre><code>vc_map( 
      array(
          'base' =&gt; 'foo',
          'params' =&gt; array( 
              array(
                  'type' =&gt; 'attach_images',
                  'param_name' =&gt; 'images',
              ),
          );
      );
  );
  </code></pre>
  
  <p>My shortcode (so far) looks like this:</p>
  
  <pre><code>function foo_shortcode($atts){
  
      extract( shortcode_atts( array (
          'images' =&gt; '',
      ), $atts ) );
  
      $images = $unkonwn_foreach_loop;
  
      $output = '&lt;div class="gallery"&gt;' . $missing_list_of_src_elements . '&lt;/div&gt;' . "\n";
  
      return $output;
  
  }
  add_shortcode( 'foo', 'foo_shortcode' );
  </code></pre>
  
  <p>I've looked at several tutorials, I've read a bunch of articles, I've gotten closer and further away, but haven't got it cracked yet. I didn't think there was much point in adding all my failed attempts as examples, so I stripped down the code above to only the lines that I know are fine.</p>
  
  <p>Any help understanding how to put this together is, as always, greatly appreciated.</p>
  
  <p>thanks!</p>