Title: wordpress post gallery test
Last modified: August 21, 2016

---

# wordpress post gallery test

 *  [peterlunglum](https://wordpress.org/support/users/peterlunglum/)
 * (@peterlunglum)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/wordpress-post-gallery-test/)
 * Hi all,
 * I’m new to wordpress and am wondering how I can get a post gallery working in
   my php files. As it is currently I have the following code:
 *     ```
       <?php
       $gallery_atts = array (
       'post_parent' => $post->ID,
       'post_mime_type' => 'image'
   
       );
   
       $gallery_images = get_children($gallery_atts);
   
       if (!empty($gallery_images)) {
       $gallery_count = count($gallery_images);
       $first_image = array_shift($gallery_images);
       $display_first_image = wp_get_attachment_image($first_image->ID);
       ?>	
   
       <figure class="article-preview-image">
       <a href="<?php the_permalink(); ?>" <?php echo $display_first_image; ?> </a> </figure>
       <?php }
       ?>
       ```
   
 * This is all for a content gallery php file I’m making for a personal wordpress
   theme. I’ve been following tutorials and following some intuition, but I’ve run
   into a wall here as I think some of the sources I’m using may be outdated. Any
   help is appreciated, thanks!

The topic ‘wordpress post gallery test’ is closed to new replies.

## Tags

 * [content php](https://wordpress.org/support/topic-tag/content-php/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [peterlunglum](https://wordpress.org/support/users/peterlunglum/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/wordpress-post-gallery-test/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
