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

WordPress Trac noreply at wordpress.org
Tue Nov 29 04:14:26 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                       |  Resolution:
 Keywords:  has-unit-tests dev-feedback  |     Focuses:  template
-----------------------------------------+------------------------------
Changes (by TomasM):

 * focuses:   => template


Comment:

 @wido I would like to ask you one related question. One user reported to
 me this error:

 ''Not sure if it is just my setup (Ubuntu edge - PHP
 7.0.8-0ubuntu0.16.04.3 (cli) ) but when I add a featured image to a post I
 get:
 Notice: Array to string conversion in /var/www/html/wordpress-network/wp-
 content/themes/tiny-framework/functions.php on line 811
 and the same again when I click on an image which has been added to a
 gallery page using the built in Wordpress create a gallery function. I see
 that in image.php you have:''

 {{{#!php
 <?php
 $image_size = apply_filters( 'tinyframework_attachment_size', array( 960,
 960 ) );
 }}}


 ''and in functions.php line 811 you have:''

 {{{#!php
 <?php
 $classes = 'attachment-' . $size . ' size-' . $size;
 }}}


 ''I changed it to:''

 {{{#!php
 <?php
 $classes = 'attachment-' . $size[0] . ' size-' . $size[1];
 }}}


 ''and poof! No more error. (End of his message)''

 Personally I have never seen that error and nobody else reported it, but
 if the solution is a good improvement, I will add it to my theme.

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


More information about the wp-trac mailing list