Title: Pulling upload thumbnails
Last modified: August 19, 2016

---

# Pulling upload thumbnails

 *  [dancowley](https://wordpress.org/support/users/dancowley/)
 * (@dancowley)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/pulling-upload-thumbnails/)
 * I have the following code to pull the auto generate thumbnails to display in 
   an archive page – it works fine in my local server but not now i have uploaded
   to the web. Any ideas?
 *     ```
       <ul>
   
        <?php query_posts('cat='.get_query_var('cat').'&order=ASC'); ?>
   
       	<?php if (have_posts()) : ?>
   
       		<?php while (have_posts()) : the_post(); ?>
   
               <?php
       //Get images attached to the post
   
       $args = array(
       	'post_type' => 'attachment',
       	'post_mime_type' => 'image',
       	'numberposts' => -1,
               'order' => 'DESC',
       	'post_status' => null,
       	'post_parent' => $post->ID
       );
       $attachments = get_posts($args);
       if ($attachments) {
       	foreach ($attachments as $attachment) {
       		$img = wp_get_attachment_thumb_url( $attachment->ID );
                       break;
               }
       }
       ?>
   
                   <li>
                   	<img src="<?php echo $img; ?>" alt="" />
                       <h2 class="small"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
                   </li>                
   
       		<?php endwhile; ?>
   
        	  <?php endif;?> 
   
        </ul>
       ```
   

The topic ‘Pulling upload thumbnails’ is closed to new replies.

## Tags

 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [thumbnails](https://wordpress.org/support/topic-tag/thumbnails/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [dancowley](https://wordpress.org/support/users/dancowley/)
 * Last activity: [16 years, 9 months ago](https://wordpress.org/support/topic/pulling-upload-thumbnails/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
