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,933 Points

The correct answer is: