Title: Add Attribute Itemprop
Last modified: August 20, 2016

---

# Add Attribute Itemprop

 *  Resolved [jhonb](https://wordpress.org/support/users/jhonb/)
 * (@jhonb)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/add-attribute-itemprop/)
 * Hi guys,
 * I was wondering how to add an attribute to the secondary image?
 * According to wordpress <?php the_post_thumbnail(‘thumbnail’, array(‘itemprop’
   => ‘image’)); ?>
 * I tried this:
 * <p><?php if (class_exists(‘MultiPostThumbnails’)) : MultiPostThumbnails::the_post_thumbnail(
   get_post_type(), ‘secondary-image’, array(‘itemprop’ => ‘image’)); endif; ?></
   p>
 * But it doesn’t work !
 * Thanks for your help guys !
 * Cheers,
 * Jhon
 * [http://wordpress.org/extend/plugins/multiple-post-thumbnails/](http://wordpress.org/extend/plugins/multiple-post-thumbnails/)

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

 *  Thread Starter [jhonb](https://wordpress.org/support/users/jhonb/)
 * (@jhonb)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/add-attribute-itemprop/#post-3603060)
 * Got it using functions.php
 *     ```
       add_filter('works_secondary-image_thumbnail_html','mediaboxlv_image_itemprop',10,3 );
       function mediaboxlv_image_itemprop($html, $post_id, $post_image_id){
        $html = str_replace('src',' itemprop="image" src',$html);
        return $html;
       }
       ```
   
 * Cheers 🙂
 *  [mdidesign](https://wordpress.org/support/users/mdidesign/)
 * (@mdidesign)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/add-attribute-itemprop/#post-3603310)
 * Is it possible to filter videos out of it? Because at the moment a) all images
   AND videos are marked as “image” and b) I would like to use the original image
   and not the small preview image within an article… possible?

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

The topic ‘Add Attribute Itemprop’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/multiple-post-thumbnails_d94965.svg)
 * [Multiple Post Thumbnails](https://wordpress.org/plugins/multiple-post-thumbnails/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/multiple-post-thumbnails/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/multiple-post-thumbnails/)
 * [Active Topics](https://wordpress.org/support/plugin/multiple-post-thumbnails/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/multiple-post-thumbnails/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/multiple-post-thumbnails/reviews/)

## Tags

 * [attribute](https://wordpress.org/support/topic-tag/attribute/)
 * [image attribute](https://wordpress.org/support/topic-tag/image-attribute/)
 * [itemprop](https://wordpress.org/support/topic-tag/itemprop/)

 * 2 replies
 * 2 participants
 * Last reply from: [mdidesign](https://wordpress.org/support/users/mdidesign/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/add-attribute-itemprop/#post-3603310)
 * Status: resolved