Title: Schema.org: Editing the_post_thumbnail code?
Last modified: August 21, 2016

---

# Schema.org: Editing the_post_thumbnail code?

 *  [gotmedia](https://wordpress.org/support/users/gotmedia/)
 * (@gotmedia)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/schemaorg-editing-the_post_thumbnail-code/)
 * Hi there,
 * I’m working with this code:
    `<?php the_post_thumbnail('full'); ?>`
 * What I’m trying to do is wrap it in a this tag: `<img>` because I want to add
   Structured Data Markup like so:
 * `<img itemprop="image" class="alignright size-full wp-image-753" alt="" src="
   image.jpg"/>`
 * Does anybody know how to do this?

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

 *  [bencaplan](https://wordpress.org/support/users/bencaplan/)
 * (@bencaplan)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/schemaorg-editing-the_post_thumbnail-code/#post-3927915)
 * Hi gotmedia,
 * If I understand your question correctly, you are interested in adding the `itemprop
   ="image"` portion? The function `the_post_thumbnail()` takes a second argument
   that allows you to pass in an array of HTML attributes. Thus to create this you
   could write the following:
 *     ```
       <?php
         the_post_thumbnail(
           'full',
           array(
               'itemprop' => 'image',
               'class' => 'alignright size-full wp-image-753',
               'alt' => 'image.jpg'
           )
         )
       ?>
       ```
   
 * If I am not understanding you correctly, and you are interested in using the 
   new html 5 image tag or something else then you can always query for just the
   image src like so:
 *     ```
       <?php
         $imageUrl = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );
       ?>
       ```
   
 * I hope that this helps!
 *  Thread Starter [gotmedia](https://wordpress.org/support/users/gotmedia/)
 * (@gotmedia)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/schemaorg-editing-the_post_thumbnail-code/#post-3928172)
 * Actually, the first code was PERFECT! Thank you!

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

The topic ‘Schema.org: Editing the_post_thumbnail code?’ is closed to new replies.

## Tags

 * [structured data markup](https://wordpress.org/support/topic-tag/structured-data-markup/)

 * 2 replies
 * 2 participants
 * Last reply from: [gotmedia](https://wordpress.org/support/users/gotmedia/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/schemaorg-editing-the_post_thumbnail-code/#post-3928172)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
