title: How to display attached images on single.php file in wordpress
body: <p>Maybe someone solved this problem sorry if I am asking again this question. I have one post displaying on front page now this post has one feature Image along with other images and gallery.</p>
  
  <p>What I want when user click on post so it will go on single.php to show full post view. I want to display on this single.php view an image and some text as well as a custom gallery images but not the feature image.</p>
  
  <p>how can I achieve this I wrote one code but it did not work.</p>
  
  <pre><code>function displayPostImages() { 
  
  global $post; function
  
  $attachments = get_children(array('post_parent' =&gt; $post-&gt;ID, 'order' =&gt; 'ASC', 'orderby' =&gt; 'menu_order', 'post_type' =&gt; 'attachment', 'post_mime_type' =&gt; 'image' ));
  
  
  
  $image =  get_post_thumbnail_id( $post-&gt;ID); // featured_image ID
  $featured_image = wp_get_attachment_image_src($image);
  
  if ($attachments) { // if there are images attached to posting, start the flexslider markup
      foreach ( $attachments as $attachment_id =&gt; $attachment ) { 
  
      if($attachment-&gt;ID != $image &amp;&amp; $featured_image ){
  
      $img_source = wp_get_attachment_image_src( $attachment_id, 'full' )[0];
  
      //print_r($img_source);
  ?&gt;
  
  // here will be HTML to display TOP images text and gallery images.
  
  
  
  
  
  &lt;?php
               }
           }
       }
   }
  displayPostImages();
  ?&gt;
  </code></pre>