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 WordPress Theme Development Adding a Blog to a WordPress Theme Adding a Blog to a WordPress Theme Quiz

Anastasia Khazova
Anastasia Khazova
5,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.

2 Answers

Hi Anastasia, It's:

<?php the_post_thumbnail(); ?>

You can also add a $size argument inside the parentheses. Those values could be 'full', 'large', 'medium' or '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.

August Oliver
August Oliver
5,934 Points

The correct answer is:

the_post_thumbnail