[wp-trac] [WordPress Trac] #36996: get_the_post_thumbnail and the usage of class attribute

WordPress Trac noreply at wordpress.org
Thu Jun 2 05:08:48 UTC 2016


#36996: get_the_post_thumbnail and the usage of class attribute
--------------------------+-----------------------------
 Reporter:  TomasM        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.5.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Hi, I noticed that if I use class attribute, it overrides some of the
 standard classes. So in my example I use header image of custom size:


 {{{#!php
 <?php
         echo get_the_post_thumbnail( $post->ID, 'custom-header-image-
 large', array(
                 'id'       => 'featured-image',
                 'itemprop' => 'image',
                 ) );
 }}}

 In this case WP generates these classes for the header image:

 attachment-custom-header-image-large size-custom-header-image-large wp-
 post-image

 If I add attribute `'class'    => 'photo u-photo',`

 {{{#!php
 <?php
         echo get_the_post_thumbnail( $post->ID, 'custom-header-image-
 large', array(
                 'class'    => 'photo u-photo'
                 'id'       => 'featured-image',
                 'itemprop' => 'image',
                 ) );
 }}}

 WP skips some classes and final class list produces only:

 photo u-photo wp-post-image

 Is it by design, or a possible bug?

 Thank you!

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36996>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list