Title: the_post_thumbnail problem
Last modified: August 19, 2016

---

# the_post_thumbnail problem

 *  [janper](https://wordpress.org/support/users/janper/)
 * (@janper)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/the_post_thumbnail-problem/)
 * hi
 * I’m trying to use **the_post_thumbnail** with my own parameters, but it always
   comes out with the defaults. i’m building my theme on top of _twentyten_ as a
   child theme.
    this is my code:
 *     ```
       add_image_size( 'jp-gallery-list',  500, 180, true );
       if (is_category()) {
       	global $post;
       	$args = array( 'numberposts' => 5, 'offset'=> 0, 'category' => get_query_var('cat') );
       	$myposts = get_posts( $args );
       	foreach( $myposts as $post ) :
       		setup_postdata($post);
       		?>
       		<a href="<?php the_permalink(); ?>">
       		<?php
       		if(has_post_thumbnail()) {
       			$thumb_attr = array(
       				'class'	=> "gallery-list-thumb",
       				'alt'	=> the_title_attribute(array('echo' => false) ),
       				'title'	=> the_title_attribute(array('echo' => false) ),
       			);
       			the_post_thumbnail('jp-gallery-list', $thumb_attr );
       		}
       		?>
       		</a>
       		<?php
       	endforeach;
       }
       ```
   
 * however, the output is
 *     ```
       <a href="http://www.luciatallova.com/blur-minds-clear-sights/">
       <img src="http://www.luciatallova.com/wp-content/gallery/znova-nemozem-zaspat/thumbs/thumbs_165166_499474188633_99323968633_6311917_732718_n.jpg" alt="165166_499474188633_99323968633_6311917_732718_n" title="znova nemozem zaspat" class="wp-post-image ngg-image-1 " />
       </a>
       ```
   
 * which is wrong – or rather default…
 * thanks for comments!

The topic ‘the_post_thumbnail problem’ is closed to new replies.

## Tags

 * [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: [janper](https://wordpress.org/support/users/janper/)
 * Last activity: [15 years, 2 months ago](https://wordpress.org/support/topic/the_post_thumbnail-problem/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
