title: How do I show specific images from a get_children array in WordPress
body: <p>I apologize if this is answered somewhere on the site, but I've been searching since yesterday and can't seem to find an answer.</p>
  <p>I am trying to create a grid of different sized images in a custom post type. I would need the images to be added in the editor and not anywhere else. The custom post type has a featured image at the top that I created using the_post_thumbnail();
  Below that is some text, and below that I have added some images.
  The text and images have been added through the editor in the admin panel.</p>
  <p>I am not sure if this is the right way to go about it, but I've been using the get_children() function to grab all the images I've uploaded to the post.
  This is my code for that section:</p>
  <pre><code>&lt;?php
  $featuredImage = get_post_thumbnail_id( $post-&gt;ID );
  $attachments = get_children( array( 'post_parent'=&gt;$post-&gt;ID, 'post_type'=&gt; 'attachment', 'exclude'=&gt;$featuredImage ) );
  
      if ( $attachments ) {
      foreach ( $attachments as $attachment ) {
          $image_attributes = wp_get_attachment_image_src( $attachment-&gt;ID, 'thumbnail' )  ? wp_get_attachment_image_src( $attachment-&gt;ID, 'thumbnail' ) : wp_get_attachment_image_src( $attachment-&gt;ID, 'full' );
  
          echo '&lt;img src=&quot;' . wp_get_attachment_thumb_url( $attachment-&gt;ID ) . '&quot; class=&quot;project-image w3&quot;&gt;';
      }
  }
  ?&gt;
  </code></pre>
  <p>This displays all the images except the featured image.
  How can I display only the second image, for example?</p>
  <p>In the end I would like to make it so that I have an if statement that checks for number of images added, and based on the number of images in the post, apply different css classes to different images in the get_children array and display them, replacing the same images that I have added through the editor.</p>
  <p>I really appreciate the help. Please let me know if I haven't been clear enough, or if I'm going about this the wrong way.</p>
  <p>Thanks!</p>
  <h2>Update</h2>
  <p>I am trying to replace the images I added through the wordpress editor with the new images in their desired divs I created using the get_children() function. Is preg_replace() the way to go?</p>