Title: the_post_thumbnail title
Last modified: August 19, 2016

---

# the_post_thumbnail title

 *  [turbolemonjames](https://wordpress.org/support/users/turbolemonjames/)
 * (@turbolemonjames)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/the_post_thumbnail-title/)
 * Hi I’m using the following to retrieve the post featured image
 * I was just wondering how I’d display the article title as the image title, as
   at the moment a site I’m working on has hundreds of articles which all have random
   number titles such as “4546-46464”
 * I know the tag the_title will retrieve the article title but I’m not sure how
   to insert it into this tag
 * `<?php the_post_thumbnail('large', 'title='); ?>`
 * This for a jquery plugin which is why I’m using the title tag.
 * Cheers for any help

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Rafael Sirotheau](https://wordpress.org/support/users/rsirotheau/)
 * (@rsirotheau)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/the_post_thumbnail-title/#post-1814855)
 * The Codex Exemplifies this:
 *     ```
       $attr = array(
       		'src'	=> $src,
       		'class'	=> "attachment-$size",
       		'alt'	=> trim(strip_tags( $attachment->post_excerpt )),
       		'title'	=> trim(strip_tags( $attachment->post_title )),
       		);
   
       <?php the_post_thumbnail( $size, $attr ); ?>
       ```
   
 * so, you could try this:
    `<?php the_post_thumbnail('large', 'title='.trim(strip_tags(
   $attachment->post_title ))); ?>`
 *  [ryanmaurodesign](https://wordpress.org/support/users/ryanmaurodesign/)
 * (@ryanmaurodesign)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/the_post_thumbnail-title/#post-1815132)
 * This worked perfectly for me. I now have a thumbnail image whose title reflects
   the associated post.
 * Another way to do this would be to create an image tag and put the post thumbnail’s
   url into the image’s src attribute and the post title into the image’s title 
   attribute.

Viewing 2 replies - 1 through 2 (of 2 total)

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

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 3 participants
 * Last reply from: [ryanmaurodesign](https://wordpress.org/support/users/ryanmaurodesign/)
 * Last activity: [14 years, 6 months ago](https://wordpress.org/support/topic/the_post_thumbnail-title/#post-1815132)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
