Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Konrad Pilch
Konrad Pilch
2,435 Points

HOw do I display thi the right wya?

<img class="post-blog-img"<?php the_post_thumbnail(); ?>

I need the img tag , this doesnt work well

1 Answer

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Try this:

<?php 

     $attr = array(
          'class'  =>  'post-blog-img'
     );     
     the_post_thumbnail( 'full', $attr ); 

?>

Here is the documentation on the_post_thumbnail():

https://codex.wordpress.org/Function_Reference/the_post_thumbnail