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!
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
Anastasia Khazova5,640 Points
What function would you use to display the feature image for a post?
Who knows the answer?
I put : the_author_post_link () and it is wrong.
Eric Butler33,512 Points
Hi Anastasia, It's:
<?php the_post_thumbnail(); ?>
You can also add a
$size argument inside the parentheses. Those values could be
'thumbnail'. Here is the documentation page (I encourage you to make a habit of checking the WP "Codex" -- their official docs): https://codex.wordpress.org/Function_Reference/the_post_thumbnail_url
That will render the image out as a complete HTML element. If you only wanted to get the image's URL so you can write your own HTML, you'd do that like this:
<img src="<?php the_post_thumbnail_url(); ?>" alt="">
Hope this helps you! Let me know.